Shut down your Raspberry Pi on button press and add reset function

Connect a shutdown-pushbutton to header 5 (pin 6 and 8) and a reset button to header 6 (pin 1 and 2). Copy shutdown.py to your /home/pi folder, and add line in crontab with crontab -e: "@reboot sudo python /home/pi/shutdown.py" (without the quotes). Done.





Das Script legt eine Interruptroutine an, die bei einer fallenden Flanke am GPIO pin 31 angesprungen wird.