mirror of
https://github.com/libretro/Lakka-LibreELEC.git
synced 2025-03-01 06:51:22 +00:00
Co-authored-by: David Lawson <dmrlawson@gmail.com> Co-authored-by: Albert Malina <albert.malina@gmail.com>
23 lines
453 B
Python
Executable File
23 lines
453 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
# This script has been created using the following as a reference:
|
|
# https://github.com/RetroFlag/retroflag-picase
|
|
|
|
from gpiozero import Button, LED
|
|
import os
|
|
from signal import pause
|
|
|
|
powerPin = 26
|
|
powerenPin = 27
|
|
hold = 1
|
|
power = LED(powerenPin)
|
|
power.on()
|
|
|
|
#functions that handle button events
|
|
def when_pressed():
|
|
os.system("shutdown -P now &")
|
|
|
|
btn = Button(powerPin, hold_time=hold)
|
|
btn.when_pressed = when_pressed
|
|
pause()
|