Add example shutdown python script

parent 20dcbf17
Pipeline #14 skipped
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
import os
SAFEPI_PIN=36
GPIO.setmode(GPIO.BOARD)
GPIO.setup (SAFEPI_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
if (GPIO.input(SAFEPI_PIN) == False):
print "SafePI detected power loss. Shutting down the system"
os.system ("shutdown -h now")
break
time.sleep (1)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment