XBMC: Difference between revisions
→LibreElec Shutdown Button
Line 117:
== LibreElec Shutdown Button ==
[[File:Pi shutdown switch.png|thumb|right]]
Source: [https://forum.libreelec.tv/thread/1754-problem-installing-pi-tools-addon/ libreelec.tv], [https://lowpowerlab.com/forum/atxraspi/libreelec-python-script/ lowpowerlab.com], [https://wiki.libreelec.tv/config.txt libreelec.tv]
Line 139 ⟶ 141:
GPIO.setmode(GPIO.BCM)
GPIO.setup(3, GPIO.IN, pull_up_down = GPIO.PUD_UP)
# Our function on what to do when the button is pressed
def Shutdown(channel):
os.system("poweroff")
# Add our function to execute when the button pressed event happens
GPIO.add_event_detect(3, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)
# Now wait!
while 1:
|