User Tools

Site Tools


en-us_commands:reference:wdt_disable

WDT_DISABLE()

WDT_DISABLE() stops the Watchdog.

WDT_DISABLE command operation flow

void WDT_DISABLE()

Commands

Command Arguments Return Value Operation
WDT_DISABLE() None void Stops the Watchdog.

Example

This example uses MPINO-16A8R8T digital input D22. When D22 becomes HIGH, it disables the watchdog once and does not enable it again.

bool watchdogActive = true;
 
void setup() {
  WDT_ENABLE(WDT_2S);  // Start the two-second watchdog.
}
 
void loop() {
  if (watchdogActive && digitalRead(22) == HIGH) {
    WDT_DISABLE();  // Disable the watchdog when D22 becomes HIGH.
    watchdogActive = false;
  }
  if (watchdogActive) WDT();  // Feed the watchdog only while it is active.
  delay(100);
}

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.txt · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki