Last active
January 10, 2018 21:28
-
-
Save martinohanlon/71a0c61abc0aef73104ae58f8e6bc482 to your computer and use it in GitHub Desktop.
BlueDot shutdown on double press
This file contains 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
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