For those who want to have a shutdown button for your DHAP instead of remotely shutting it down from your radio.. You may have forgotten, and this allows you to just press a button to turn it off. Also how to add a soft reset button as well..
This could very well be "DHAP R3" for future production...
-- shutdown.py code --
DHAP/RPi Shutdown routine
import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(25, GPIO.IN, pull_up_down = GPIO.PUD_UP)
def Shutdown(channel):
os.system("sudo shutdown -h now")
GPIO.add_event_detect(25, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)
while 1:
time.sleep(1)
-- End code --
code for the rc.local file: sudo python /home/pi/scripts/shutdown.py
edit rc.local with this command: sudo nano /etc/rc.local