|
The following diagram shows how to construct a push button for a Raspberry Pi which is connected to a GPIO pin.
Use Python to detect for a push button being pressed. The following code will print Button Pressed when the button is pressed and Not Pressed when it is not pressed.
import RPi.GPIO as GPIOGPIO.setmode(GPIO.BCM)GPIO.setup(4, GPIO.IN)while True:
|

