I’m trying to add two LEDs and two switches to Mango V2 using gpio4,5,45,46.
LEDs are working fine. Switches not so much.
Any tips?
schematic is dead simple, switch gpio pulled down to GND w/ 10Kohm resister.
I’m doing something like this in software
echo “5” > /sys/class/gpio/unexport
echo “gpio 5”
echo “5” > /sys/class/gpio/export
echo “in” > /sys/class/gpio/gpio5/direction
cat /sys/class/gpio/gpio5/value
When you switch the switch from one side to another.what’s the value of GPIO5?
The attach pic is a switch i found,please check with yours.
Regards
My switch is similar. I only used center pin and one other pin. I snipped off the 3rd pin.
I did get it working. Oddly, some of the gpio pins only want to work as in or out.
I’m using gpio5 and gpio46 on the switches.
root@LEDE:~# cat getsw
#!/bin/sh
echo gpio5
cat /sys/class/gpio/gpio5/value
echo gpio46
cat /sys/class/gpio/gpio46/value
Flipping switches and running above commands a few times, I get…
root@LEDE:~# ./getsw
gpio5
0
gpio46
0
root@LEDE:~# ./getsw
gpio5
1
gpio46
1
root@LEDE:~# ./getsw
gpio5
0
gpio46
1
root@LEDE:~# ./getsw
gpio5
1
gpio46
0