reset()

Description

Reset the watchdog timer, also known as “kicking the dog” (Sets the watchdog timer counter to zero)

Syntax


TimerWDT.reset()

Parameter

None

Return

None

Example

Set up watch dog timer to watch dog mode and to reboot the system every 30 seconds. Simultaneously, reset the watch dog timer every 10 seconds to prevent system reboot. This will prevent the system from ever rebooting unless the system “crashes”, in which case, the watch dog timer will reboot the system after 30 second and system will reboot.

#include <TimerWDT.h>
unsigned long currentTime;  
void setup() 
{
  TimerWDT.initialize(30000000, true); // set up 30s time interval
  currentTime = millis();
}

void loop() {
  // reset watch dog every 10s to avoid system reboot by watch dog timer
  if((millis() - currentTime) > 10000)
  {
    TimerWDT.reset(); // Reset the watch dog timer
    currentTime = millis();
  }
  // Owner function ...
}

See also

isResetByWDT()


Libraries Reference Home

The text of the 86Duino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.