Skip to content

Instantly share code, notes, and snippets.

@martinohanlon
Last active January 10, 2018 21:28
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 martinohanlon/71a0c61abc0aef73104ae58f8e6bc482 to your computer and use it in GitHub Desktop.
Save martinohanlon/71a0c61abc0aef73104ae58f8e6bc482 to your computer and use it in GitHub Desktop.
BlueDot shutdown on double press
from bluedot import BlueDot
from subprocess import call
# create a function which will be called when then bluedot is double pressed / swiped
def shutdown_pi():
call("sudo halt", shell=True)
# create the blue dot
bd = BlueDot()
# call the shutdown_pi function when its double pressed
bd.when_double_pressed = shutdown_pi
# or when its swiped
bd.when_swiped = shutdown_pi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment