Raspberry Pi - GPIO Basics with Python
What will be printed by this code if the button connected to pin 21 is pressed (assuming pull-down resistor setup)?
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
if GPIO.input(21):
print("Button Pressed")
else:
print("Button Released")