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
Auf dieser Seite können Sie das Online-Video How to program (Python) and install a shut down button for your DHAP mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Joeteck 04 Dezember 2014 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 469 Mal angesehen und es wurde von 3 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!