I need help with programming if anyone can help me
I use an arduino nano r 3 a switch and a module with 2 relays
I am interested in pressing the button to start the first relay and after 10 seconds to switch on the second relay,the button must be maintained during the process,after switching off the relay, the relay switching must be reversed, that is to say relay relay 2 and after 5 seconds relay 1
this cycle must work at every push of a button
Meantime, and assuming if the button is let go early it must go back to "standby" mode with relay1 off, I wrote a state machine sketch that does what you want. Here's the serial output from a session where first the button was released early, and then held long enough:
In STANDBY phase; relays are off
Press **and hold** the button to start the sequence
Button newly pressed, going to ON phase
In ON phase: relay1 is on
Hold button >10s to activate relay2
(Premature release will cause return to STANDBY with relays off)
Button released after 150, premature return to STANDBY phase
In STANDBY phase; relays are off
Press **and hold** the button to start the sequence
Button newly pressed, going to ON phase
In ON phase: relay1 is on
Hold button >10s to activate relay2
(Premature release will cause return to STANDBY with relays off)
Relay2 now on
Button released after 11486, going to OFF phase
In OFF phase: relay2 is off. Relay1 will follow
Relay1 now off
In STANDBY phase; relays are off
Press **and hold** the button to start the sequence
I need help with programming if anyone can help me
I use an arduino nano r 3 a switch and a module with 2 relays
I am interested in pressing the button to start the first relay and after 10 seconds to switch on the second relay,the button must be maintained during the process,after switching off the relay, the relay switching must be reversed, that is to say relay relay 2 and after 5 seconds relay 1
this cycle must work at every push of a button
thank you and a beautiful day
You won't get the solution of your complete project here. Take it step by step.
First test the input example and test your switch then try relay and delays etc.
You can use Proteus software for testing your code.