Control gpio at boot for relays
I have added a nice 12v led marque style bar to by bartop. I'm trying to use a sainsmart 4 relay board to turn the leds and speakers on and off with the pi. I have the reset on/off led setup wired now. I read that wiringpi was added in 4.0.0 beta 1. following the wiringpi examples for a simple blink script returns gcc command not found. how can I pull a gpio to ground on boot? Thanks as always. attached is pic of the fake coin door I 3d printed. the onoffresetled worked perfect with it thank you
ok I've had time to think about this problem more and I believe I have a solution though I havent tested it yet.
Since I have the onoff switch which toggles a pin to ground AND I have a 4 relay module I should be able to do it all.
I'll have the onoff switch toggle ground to all 4 relays, then use one relay to toggle ground to the onoff gpio pin. the other three will operate the speakers, led lighting, and power to the monitor.
I'll report back with results in case it is helpful to others
Substring last edited by
I won't say i understand everything crystal clear but :
- wiringpi returns a gcc error : no gcc on recalbox and anyway afair wiringpi is in python but i can be wrong
- once again, python is the easiest language to play around with gpio. If you want to set gpio values at boot, you will need to write a script in /etc/init.d
@subs thank you. I'm new to python so just knowing thats the route is a big help. So far using one relay to toggle the power state of the pi is working very well. it's nice to have all my custom lighting and speaker/monitor turn fully off while operating the pi with the same switch.