I am using Nextion-enhanced with arduino.. As it is Nextion enhanced version, it has gpio pins.. i am using it for driving relays.. Problem is when i starting the device, relay automatically closes at a very short time.. then it back to programmed stage.. How can I clear this problem.. ie, undefined pin stage at the start up..?
External pullup or pulldown resistors?
For the common relay modules with opto coupler you must write a HIGH to the pin before setting the pin with pinMode to OUTPUT.
digitalWrite(relayPin, INPUT_PULLUP); // enable internal pull up pinMode(relayPin, OUTPUT);