pdf-icon

Watch Dog Timer

Example

Set the Watch Dog Timer to reset the device when the program abnormally fails to perform the feed operation at the expected time.

from m5stack import *
from m5ui import *
from uiflow import *
from machine import WDT
import time


setScreenColor(0x222222)

wdt = WDT(timeout=2000)
while True:
  wait(3000)
  wdt.feed()
  wait_ms(2)

API

wdt = WDT(timeout=2000)
  • Initialize Watch Dog Timer and set the timeout period
wdt.feed()
  • Repeat the feed operation within the timeout period to refresh, and reset the device if the timeout period is too long for the feed.
On This Page