I have a simple circuit that goes to a garage door contact sensor then to a resistor then to an LED to show if the circuit is open or closed. I've confirmed that my wiring works with a power source - when the door is closed, the circuit is closed and the light turns on. Light turns off when the door is open.
Then when wired it to my RPI, I'm using
GPIO pin 20 and
ground pin 34. Using the GPIO commands, I can't see to get the circuit to close correctly and export the circuit value. The exported value is always
1. I was able to get my circuit to close and light the LED by doing these commands
gpio -g mode 20 in gpio -g mode 20 up gpio export 20 in
The LED is on when the door is closed and the exported value is
1 but it remains
1 when the door is open. I would expect the export value to change?
My question is - Do I have this wired to the right pins? Am I using the right commands?
Edit: added pic. Yellow wire is incoming from GPIO pin 20. Purple and gray wires are my sensor