Last active
January 21, 2016 15:31
-
-
Save mfitzp/59a579e65d029129ad78 to your computer and use it in GitHub Desktop.
GPIO example
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
def down(): | |
if GPIO.input(7) == False: | |
# Turn on the LED | |
GPIO.output(13, True) | |
# Loop until we're at the bottom | |
while GPIO.input(7) == False: | |
time.sleep(0.5) | |
# Now turn off the light | |
GPIO.output(13, False) | |
print("You have reached the ground floor.") | |
else: | |
print("You're already on the ground floor.") | |
# Don't call the parent function here, you'll end up recursing. | |
# button_select() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment