Enabling internal pull-up resistor
Without pull-up pin is floating and can cause random shutdowns.
This commit is contained in:
parent
8dce212eb3
commit
0b506b26ff
|
@ -6,7 +6,7 @@ import subprocess
|
|||
|
||||
|
||||
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)
|
||||
|
||||
subprocess.call(['shutdown', '-h', 'now'], shell=False)
|
||||
|
|
Loading…
Reference in New Issue