Include the header file:
#include <avr/wdt.h>
Enable the WDT

Typically in your applications setup() function


Possible issue: We’ve had issues with the watchdog enabled and program uploading never leaving the “Uploading…” stage, where disabling the watchdog would fix the issue. There may be a need to delay turning on the WDT at start – TBC.

Available time periods:

ATMega 8, 168, 328, 1280, 2560:
WDTO_15MS (15 ms )
WDTO_30MS (30 ms)
WDTO_60MS (60 ms)
WDTO_120MS (120 ms)
WDTO_250MS (250 ms)
WDTO_500MS (500 ms)
WDTO_1S (1 sec)
WDTO_2S (2 sec)

Reset the watchdog

For instance in your main loop


We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


Your email address will not be published. Required fields are marked *