en-us_commands:reference:wdt_disable
This is an old revision of the document!
Table of Contents
WDT_DISABLE()
Commands
| Command | Arguments | Return Value | Operation |
|---|---|---|---|
WDT_DISABLE() | None | void | Stops the Watchdog. |
Example
void setup() { #if defined(__AVR_ATmega2560__) WDT_ENABLE(WDT_2S); // Set the watchdog timeout and start operation. #elif defined(__AVR_ATmega128__) WDT_ENABLE(WDT_1800MS); // Set the watchdog timeout and start operation. #endif } void loop() { const bool maintenanceMode = IdigitalRead(0, 5); // Read the input repeatedly and update only if all samples match. If HIGH and LOW are mixed, retain the previous stable state. if (maintenanceMode) { WDT_DISABLE(); // Stop the watchdog. return; } 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.
en-us_commands/reference/wdt_disable.1788791736.txt.gz · Last modified: by 127.0.0.1
