Skip to content

Instantly share code, notes, and snippets.

@felipefdl
Created March 6, 2015 02:25
Show Gist options
  • Save felipefdl/af345e3bbbe57976ea28 to your computer and use it in GitHub Desktop.
Save felipefdl/af345e3bbbe57976ea28 to your computer and use it in GitHub Desktop.
import RPi.GPIO as gpio
gpio.setmode(gpio.BCM)
gpio.setup(4, gpio.OUT)
def toggle_led():
status = gpio.input(4)
if status == 0:
gpio.output(4, True)
else:
gpio.output(4, False)
while True:
key = raw_input()
if key == 'q':
gpio.cleanup()
exit(0)
toggle_led()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment