Rev Author Line No. Line
4686 kaklik 1 #!/usr/bin/python
2 import wiringpi2 as gpio
3 import time
4 import subprocess
5  
6 gpio.wiringPiSetupGpio()
7 gpio.pinMode(88, 0)
8 gpio.pullUpDnControl(88, 0)
9  
10  
11 oldstav = gpio.digitalRead(88)
12  
13 while True:
14 stav = gpio.digitalRead(88)
15  
16 if stav != oldstav and stav == 0:
17 subprocess.call("shutdown -P 1", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
18 oldstav = stav
19  
20 time.sleep(1)
21  
22