I have an easy circuit wired up, with an LED connected to pin 18 on the BOARD reference. I run a simple program to put pin 18 to HIGH, which turns the LED on, and then a couple of seconds later, I set pin 18 to LOW, and finally I end my program with GPIO.cleanup().
At this point the LED is off, which means that pin 18 is off (LOW). Now I reboot or restart my Raspberry Pi, and when it boots back up, the LED on pin 18 turns on again, even though the pin was off before I rebooted the Raspberry Pi.
Why may this be happening? How can I configure a specific pin, like pin 18 to be off when the Raspberry Pi boots up? And I don't want any GPIO pins to be on HIGH when the Raspberry Pi boots up.
I am concerned about this problem, because let's say that pin 18 is connected to a DC motor on a robot, and when the Raspberry Pi boots up, the motor will turn on, and this is not something that I want because that will interferes with the whole structure of the robot, and some motors might start and others won't, depending on the pins they are connected to. I want to manually turn on all the motors in a synchronized manner.
One other thing is that not all the pins have this problem. Some stay off when the Raspberry Pi boots, but others don't.
/sys/class/gpioand export pin 18, what state does the system then say it is in if you change nothing?
echo, which writes, i.e., sets something. After you export it you want to refrain from that and just use
cat, which reads, to check the direction and the value.