there’s no pimatic solution for that as far as i know.
your relay seems to be active low.
set your gpio to active_low and it should work.
try the following :
first let the kernel create the gpio device directory
sudo echo 2 >/sys/class/gpio/export
the number 2 stands for the GPIO port 2, so if you are having your relay on another GPIO change that!
now you can set the GPIO to active low with the following command :
sudo echo 1 >/sys/class/gpio/gpio2/active_low if you are having another GPIO in use, change the directory accordingly.
echo 1 will set the state 1 to the active_low file. this will set the GPIO to active low then.
if you want to revert the above you can do so with :
sudo echo 0 >/sys/class/gpio/gpio2/active_low
you also should set the direction of the GPIO to out
sudo echo out > /sys/class/gpio/gpio2/direction
that’s it … if you want to, pls check that out and report back.
there’s a nice GPIO tutorial here but unfortunately in German only