Enabling internal pull-up resistor

Without pull-up pin is floating and can cause random shutdowns.
This commit is contained in:
Tero Korpela 2017-06-25 18:26:49 +03:00 committed by GitHub
parent 8dce212eb3
commit 0b506b26ff
1 changed files with 1 additions and 1 deletions

View File

@ -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)