I am currently trying to find a way to implement some sort of library in order to perform a reset on the whole board. But I want it happening in the “background” so that if the program gets stuck somewhere for 10 minutes then the board can be reset and started over as if it were being powered up.
If anyone has a way of doing this please let me know. I have found other libraries that only allow me to shut off the microcontroller, but it does not wake back up without power cycling.
Watchdog.enable(16000 /* ms max period */, false /* for sleep */);
Note the watchdog does not have “10 minutes” maximum time, it’s much shorter than that. Per datasheet, “max 16,000 cycles in normal mode”, whereas one cycle is the cycle of a 1 kHz clock. (I.e., one cycle = 1 / 1024 of a sceond).
Deep-Sleep / Shutdown modes of the micrcontroller can be used independently of the watchdog.
Of course, once you enable the watchdog, you will periodically need to reset it (“feed it”). If that does not happen for the set maximum time, the watchdog will trigger a reboot of the chip. Feeding the watchdog with the Adafruit library can be done with
That is the harwdare limit giving the possible clock dividers, yes.
However, no good programm should with a “superloop” architecture should have a loop iteration that costs more than 16 seconds to run. The watchdog can also be deactivated before deepsleep if needed. (Watchdog.disable();). This should be used with caution however.