Skip to content

Instantly share code, notes, and snippets.

@bennuttall
Created July 9, 2017 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennuttall/fbf90b3712106a60512e5df2f803a0e9 to your computer and use it in GitHub Desktop.
Save bennuttall/fbf90b3712106a60512e5df2f803a0e9 to your computer and use it in GitHub Desktop.
from gpiozero import Button
def exit():
global running
running = False
btn = Button(2, hold_time=5)
btn.when_held = exit
running = True
while running:
pass # or do something interesting here...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment