View difference between Paste ID: qT1tdhXL and x9WvDsJb
SHOW: | | - or go back to the newest paste.
1
# Pi Supply Soft Shutdown Script
2-
# Version 1.0
2+
# Version 1.1
3
# Nathan Bookham 2013
4
5
# Import the modules to send commands to the system and access GPIO pins
6
from subprocess import call
7
import RPi.GPIO as gpio
8
9
# Define a function to keep script running
10
def loop():
11-
	raw_input()
11+
    raw_input()
12
13
# Define a function to run when an interrupt is called
14
def shutdown(pin):
15
    call('halt', shell=False)
16
17
gpio.setmode(gpio.BOARD) # Set pin numbering to board numbering
18
gpio.setup(7, gpio.IN) # Set up pin 7 as an input
19
gpio.add_event_detect(7, gpio.RISING, callback=shutdown, bouncetime=200) # Set up an interrupt to look for button presses
20
21
loop() # Run the loop function to keep script running