I am using Raspberry Pi 3 B+ with
Linux raspberrypi 5.4.83-v7+ #1379 SMP Mon Dec 14 13:08:57 GMT 2020 armv7l GNU/Linux
to control a set of relays. I set:
gpio mode 7 output
gpio mode 0 output
gpio mode 2 output
gpio mode 3 output
gpio mode 21 output
gpio mode 22 output
and then I am able to
gpio toggle <pin_number>
The relay closes if the pin value is 1
and opens if it is 0
.
However, if I reboot, I have to set the above pins as output
again, before being able to use them and, when the RPi boots or makes shutdown, the relays always close, as if pins were set to 1
.
- Is it possible to permanently set the above pins as
output
? - Is it possible to have them always set as
0
, unless I explicitly write a1
on them (ortoggle
them)?