I have a project that I am working on. It is using relays in a pseudo-random order for on for a few seconds at a time.
The installation has a button, that the user can press to start. when pressed will run through the previously mentioned order using relays to operate water features. In the control box I want a pot that the operator(not player) can set the play_time runtime between 1 and 10 minutes, started by a button press.
It my init, I was thinking of reading the pot and setting the play_time variable. once I have my number 1 through 10 it will sit and wait for someone in the installation to press the "go" button to run through the actions of the relays.
Using a lookup table to decide what relay to fire and for how long, (or what relay is active for how many seconds).
Because it is using water, I want to use as little as possible, and not run the unit with no one there, it needs to shut off until the next person wants to play and presses the "go" button. When the "go" button is pressed, I want the order to pickup from where it left off in the table not the beginning. (anti-cheating)
I have stumped myself on how to do so. I believe the watchdog will allow the code to continue where it left off, when the "go" button interrupts and wakes the Arduino.
The Arduino will be RESET when the pot needs to be read, if the play time needs to be changed. Starting from the beginning of the lookup-table is fine in this case.
If the watchdog timer starts then, relays start clicking away, then the watchdog time runs out and puts the Arduino to sleep until the button is pressed to wake the Arduino. Does the watchdog timer reset at this point?
Is the watchdog the best thing to use?
I thank you all for your time.