summaryrefslogtreecommitdiff
path: root/buttonctl/buttond.py
diff options
context:
space:
mode:
authorStijn Buys <ingar@telenet.be>2022-02-27 23:39:24 +0100
committerStijn Buys <ingar@telenet.be>2022-02-27 23:39:24 +0100
commit88a54148c9be32b09559dc74910f1496b24e3421 (patch)
treefa5573ca5473b46df4032f430349aed11741ab29 /buttonctl/buttond.py
parentd94af12066678f40ecdf16da2c810472e452f5b8 (diff)
Renamed buttonctld to buttond.
Diffstat (limited to 'buttonctl/buttond.py')
-rw-r--r--buttonctl/buttond.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/buttonctl/buttond.py b/buttonctl/buttond.py
new file mode 100644
index 0000000..26878f1
--- /dev/null
+++ b/buttonctl/buttond.py
@@ -0,0 +1,16 @@
+#!/usr/bin/python
+
+import RPi.GPIO as GPIO
+import subprocess
+
+
+GPIO.setmode(GPIO.BCM)
+GPIO.setup(26, GPIO.IN, pull_up_down=GPIO.PUD_UP)
+GPIO.wait_for_edge(26, GPIO.FALLING)
+
+print ('button pressed')
+
+subprocess.call(['ledctl', 'boot'], shell=False)
+
+subprocess.call(['shutdown', '-h', 'now'], shell=False)
+