When the switch is open, a logic 1 (5v) is connected to the microcontroller. When the switch is closed, a logic 0 (0v) is connected to the micro, This type of resistor shown above is called a pull up resistor. A pull-up resistor is a resistor connected between the microcontroller and a positive power supply voltage.
A pull-down resistor works in the same way as a pull up resistor but is connected to ground as shown below. The microcontroller will read a logic signal of 0 when the switch is open and a logic 1 when the switch is closed..
Pull up and pull-down resistors ensure that the input signal to the microcontroller will be a valid logic level if the switch is open or closed.
A 4 pin SPST push button switch is shown below. Note that pins 1 and 3 are internally connected together. Pins 2 and 4 are also internally connected together. So when placing this type of switch on a breadboard, pins 1 and 3 is placed on the same row while pins 2 and 4 are placed on the same row.
No comments:
Post a Comment