Skip to content
Michael Miller edited this page Mar 24, 2016 · 2 revisions

This library will turn on the watchdog timer and by default set it too 500ms. If any single function takes longer than 500ms, the Arduino will reset and start over.

Platform Restrictions:

  • AVR - only the defined time values are supported.
  • Esp8266 - the passed in time is ignored. It always uses about 3.2 seconds for software watchdog. It also has a hardware watchdog that runs at a greater time period.
  • ARM - currently not supported

This is useful where a bug in the code may cause an intermittent hang and rather than have your project just hang, it will reset to a known good state. But this all requires that the developer make sure to use the Tasks to keep a single function to a small atomic piece of work that takes less time than the defined watchdog time. It is always best to keep task processing time to below 33ms to provide better response for IO tasks.

The length of the WatchDog Timer can be changed by passing in one of the flags defined in wdt.h (for AVR) and esp.h (for Esp8266) for the supported timer lengths to the loop method.

void loop()  
{  
  taskManager.Loop(WDTO_1S); // use one second watch dog timer  
}  
Clone this wiki locally