Skip to content

Instantly share code, notes, and snippets.

@mannynotfound
Created April 10, 2016 01:07
Show Gist options
  • Select an option

  • Save mannynotfound/6970c3f76dd8a6cff50e6580849505da to your computer and use it in GitHub Desktop.

Select an option

Save mannynotfound/6970c3f76dd8a6cff50e6580849505da to your computer and use it in GitHub Desktop.
Reads input from a simple GPIO arcade button to Raspberry Pi and triggers an action
#!/usr/bin/env python
import time
import RPi.GPIO as GPIO
# set up pin numbering scheme
GPIO.setmode(GPIO.BCM)
# set up pin 17 as input
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
if (GPIO.input(17) == False):
print "button pressed"
time.sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment