Skip to content

Instantly share code, notes, and snippets.

@alexohneander
Created October 11, 2017 14:33
Show Gist options
  • Save alexohneander/1d7a9a1a4b65cd236e1b301bb9df985f to your computer and use it in GitHub Desktop.
Save alexohneander/1d7a9a1a4b65cd236e1b301bb9df985f to your computer and use it in GitHub Desktop.
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(23, GPIO.OUT)
GPIO.output(18, True)
while True:
input_state = GPIO.input(18)
if input_state == False:
print('Button Pressed')
time.sleep(0.2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment