Skip to content

Instantly share code, notes, and snippets.

@mfitzp
Last active January 21, 2016 15:31
Show Gist options
  • Save mfitzp/59a579e65d029129ad78 to your computer and use it in GitHub Desktop.
Save mfitzp/59a579e65d029129ad78 to your computer and use it in GitHub Desktop.
GPIO example
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