The pin is an input in both cases.
With pull up, the pin is always connected to 3.3v internally (through a resistor) so it always reads high, until you press the button which shorts the pin to ground and it reads 0v, a low.
With pull down it is the opposite. The pin is connected to ground via a resistor so it always reads low, until you press the button shorting the pin to 3.3v and the pin now reads a high.
The resistor is there to prevent a short circuit between ground an 3.3v when the button is pressed.
Google active high and active low to see pics of how it works.
With pull up, the pin is always connected to 3.3v internally (through a resistor) so it always reads high, until you press the button which shorts the pin to ground and it reads 0v, a low.
With pull down it is the opposite. The pin is connected to ground via a resistor so it always reads low, until you press the button shorting the pin to 3.3v and the pin now reads a high.
The resistor is there to prevent a short circuit between ground an 3.3v when the button is pressed.
Google active high and active low to see pics of how it works.
Statistics: Posted by memjr — Mon Jul 29, 2024 3:26 am