Created
March 6, 2015 02:25
-
-
Save felipefdl/af345e3bbbe57976ea28 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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