You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
550 B
Python

# button setup (connect to GND and board Pin 19)
import RPi.GPIO as GPIO # GPIO pins
#import time
def preview_button():
GPIO.setmode(GPIO.BOARD) #Use the physical board number (not GPIO numbering)
GPIO.setup(19, GPIO.IN, pull_up_down=GPIO.PUD_UP) #Change pin if necessary #preview button
GPIO.setwarnings(False) #Ignore warnings
preview_button_pressed = False
if GPIO.input(19) == GPIO.LOW:
#time.sleep(1)
preview_button_pressed = True
GPIO.cleanup() #GPIO clean up
return preview_button_pressed