Good morning everyone,
i'm working in a project that involves having an state pin and button detection.
The escenario is the following:
- when raspberry pi finish booting, a pin is pulled HIGH (this is done via rc.local). That pin acts as "correct boot" state, and it will draw a little current (as it's powering a small circuit).
- when that pin is pulled to ground, via a push button, i want to execute a shutdown command.
The current code is:
import RPi.GPIO as GPIO import os pinNum = 26 GPIO.setmode(GPIO.BCM) GPIO.setup(pinNum, GPIO.IN, pull_up_down=GPIO.PUD_UP) try: GPIO.wait_for_edge(pinNum, GPIO.FALLING) os.system("sudo shutdown -h now") except: pass GPIO.cleanup()
The circuit hanging from that pin draws 0.2uA, which is not enough to trigger the edge detection, but, it eventually triggers the falling edge detection.
I'm working in the filtering of that circuit, as i suspect that is some AC oscillation or transient on that circuit that triggers that. I'll post how the debbuging gets.
is there a more efficient/intelligent way to do this?