====== WDT_ENABLE() ====== ''WDT_ENABLE()'' sets the Watchdog timeout and starts it. {{:en-us_commands:reference:wdt_enable.svg?900|WDT_ENABLE command operation flow}} ''void WDT_ENABLE(uint8_t ms)'' ===== Commands ===== ^ Command ^ Arguments ^ Return Value ^ Operation ^ | ''WDT_ENABLE(ms)'' | ''uint8_t ms'' | ''void'' | Sets the Watchdog timeout and starts it. | ===== Example ===== void setup() { #if defined(__AVR_ATmega128__) WDT_ENABLE(WDT_900MS); // Set the watchdog timeout and start operation. #elif defined(__AVR_ATmega2560__) WDT_ENABLE(WDT_1S); // Set the watchdog timeout and start operation. #endif } void loop() { WDT(); // Refresh the watchdog before its timeout expires. } ===== Precautions ===== * Use time constants supported by the MCU. * Do not set a timeout shorter than the longest normal processing time. * Do not hide program faults by placing ''WDT()'' where it always executes unconditionally. ===== Built-in Commands in the Same Category ===== * [[:en-us_commands:reference:wdt_disable|WDT_DISABLE() View detailed description]] * [[:en-us_commands:reference:wdt|WDT() View detailed description]] [[:en-us_commands:builtin|← Built-in Command List]]