Prevent gpio from toggling at power up

@mat_pav Actually, I don’t remember what I had for lunch today so, remembering what I did in January, is quite a challenge for my memory :wink:

Even though this’ not Blynk related, if I was to redo it now I’d do this way [not tested and not sure if is the best way to go]

Create a py file (initRelays.py) with the following code:

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

#set array for relay pins
relayPins = [17,18,22,23]

#set output mode for all relay pins 
GPIO.setup(relayPins, GPIO.OUT)
 
#set relays GPIO to HIGH (off)
for x in relayPins:
	GPIO.output(x, GPIO.HIGH)

Then edit your crontan (crontab –e) and add on the last line

@reboot python /path/to your file/initRelays.py

reboot

If you’re having a problem with your Blynk code, post it and someone will definitely help you.

Good luck.