I am a hardware noob, and was wondering what exactly does PUD_DOWN vs PUD_UP do?
I followed a PIR sensor tutorial and it used GPIO.setup(4, GPIO.IN, pull_up_down = GPIO.PUD_UP)
Thank you! This is probably the best plain English response for what this does that I've found.joan wrote:An input gpio will float between 0 and 1 if it's not connected to a voltage.
The pull-up/downs supply that voltage so that the gpio will have a defined value UNTIL overridden by a stronger force.
You should set a pull-down (to 0) when you expect the stronger force to pull it up to 1.
You should set a pull-up (to 1) when you expect the stronger force to pull it down to 0.
Otherwise the gpio will not change state and you'll never know about the external event.