I want to drive the relay module via gpio2
root@GL-MT300N:~# echo “2” > /sys/class/gpio/export
root@GL-MT300N:~# echo “out” > /sys/class/gpio/gpio2/direction
The relay was on
root@GL-MT300N:~# echo “0” > /sys/class/gpio/gpio2/value
But it had no effect.
someone help me…
justin
June 28, 2016, 7:09am
2
Hello,
So when you ran echo “out” > /sys/class/gpio/gpio2/direction, the relay turned on?
I’m no expert with GPIO but I know when I tested this on a similar board (Raspberry Pi) running the opposite turned the relay off. Example:
echo “in” > /sys/class/gpio/gpio2/direction
I’m not sure if this is the correct way of doing this, so if someone else has any recommendations I too would love to hear them.
Hello,
echo “out” > /sys/class/gpio/gpio2/direction the relay turn on
echo “0” > /sys/class/gpio/gpio2/value no effect
echo “1" > /sys/class/gpio/gpio2/value no effect
echo “in” > /sys/class/gpio/gpio2/direction the relay turn off
other board has
echo “out” > /sys/class/gpio/gpio2/direction (write mode)
echo “1” > /sys/class/gpio/gpio2/value turn on
echo “0” > /sys/class/gpio/gpio2/value turn off
echo “out” > /sys/class/gpio/gpio2/direction (read mode)
echo “1” > /sys/class/gpio/gpio2/value deny
<span style=“line-height: 1.5;”>I don’t know ,what to do</span>
justin
June 29, 2016, 12:45pm
4
I’m afraid I don’t understand what you mean, what are you trying to accomplish?
Also if you don’t mind me asking, could you please attach a wiring diagram / image if possible? I’d really love to do this myself and test but I can’t seem to get the GPIO pinout right.
***** solved ****
Hello
Tis is my wire.
Finally, I was using “clean” image.
#opkg install gpioctl-sysfs
/etc/rc.local add this
gpioctl dirout-low 2
*turn on
#gpioctl set 2
*turn off
#gpioctl clear 2
However ,this didn’t work 2.16.
thank you.
alzhao
June 30, 2016, 11:42am
6
Glad that you solved it. Although I am not sure what is the problem.