I wrote an app that measures and reports pool water chemistry every X minutes.
Can I use a watchdog timer that will reset the arduino if there is no activity for 60 minutes?
My code has various delays() and while-millis() that create various places (invoking wifi and posting routines, for example) with up to 10 second pauses.
The goal (besides learning) is have the unit reset itself if it stops functioning.
I see that it is recommended to insert multiple wdt_reset() statements to prevent triggering of the WDT.
It seems that would require many such statements and lots of testing to make sure they are inserted everywhere that a delay of more than 8 seconds is expected.
Is there an easiest (even if it is less reliable) way to ensure the system doesn't crash/halt/fail?
(BTW, I tried 8 seconds and it failed. 2 seconds is the max. I think it's the Uno WiFi Rev 2 chip.)
It seems that would require many such statements and lots of testing to make sure they are inserted everywhere that a delay of more than 8 seconds is expected.
In theory, very little in an embedded system should take more than 8 seconds.
You'd typically put the Watchdog Reset at the top of loop() and use "without delay()" tactics in all the code.
If you really needed it, you could do something like: