how to get a stable and predicable OUT GPIO State?

Hi there,

A few days ago I just finished an ESP-01 relay based SONOFF switch and in order to turn on the output the MCU's OUTPUT has to be low so right after I initiate the pin I turn it high but when ever I reboot the thing the relay clicks unintentionally and then goes HIGH to keep it off,

Now is there a way to make it more stable and have the gpio go HIGH from the moment the system receives electricity to prevent this clicking?

as you could imagine this behavior wouldn't fit it explosive detonations and such if desired :slight_smile:

Thanks for helping!

Do

digitalWrite(HIGH);

before the pinMode()

(deleted)