Last active
June 3, 2018 13:51
-
-
Save massimomusante/fbc2cf5170be469f7cecb96963f61eae to your computer and use it in GitHub Desktop.
Raspberry PI listen for shutdown script
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
#!/usr/bin/env python | |
import RPi.GPIO as GPIO | |
import subprocess | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP) | |
GPIO.wait_for_edge(3, GPIO.FALLING) | |
subprocess.call(['shutdown', '-h', 'now'], shell=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment