Enabling internal pull-up resistor
Without pull-up pin is floating and can cause random shutdowns.
This commit is contained in:
@@ -6,7 +6,7 @@ import subprocess
|
|||||||
|
|
||||||
|
|
||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.setmode(GPIO.BCM)
|
||||||
GPIO.setup(3, GPIO.IN)
|
GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
||||||
GPIO.wait_for_edge(3, GPIO.FALLING)
|
GPIO.wait_for_edge(3, GPIO.FALLING)
|
||||||
|
|
||||||
subprocess.call(['shutdown', '-h', 'now'], shell=False)
|
subprocess.call(['shutdown', '-h', 'now'], shell=False)
|
||||||
|
|||||||
Reference in New Issue
Block a user