Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (16 sloc) 519 Bytes
polls input pin every half second to see if button is pressed
if the button is pressed and released quickly the input is not captured
import RPi.GPIO as GPIO
import time
# setup pin 7 as input with a default value of ON
GPIO.setup(7, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
# if the button is pressed, the circuit connected, then pin 7 will beocme LOW or OFF
if(GPIO.input(7)) == False:
print('Button is pressed')
print('Button is not pressed')