watchdog.py
# Questo lavoro è concesso in licenza MIT.
# Copyright (c) 2013-2026 OpenMV LLC. Tutti i diritti riservati.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# Esempio di Watchdog
#
# Questo esempio mostra come utilizzare il Watchdog Timer.
#
# Quando si preme il pulsante SW, il software smetterà di alimentare
# il watchdog timer, causando un reset del sistema.
import time
from machine import WDT, Pin, LED
sw = Pin("SW", Pin.IN)
b = LED("LED_BLUE")
wdt = WDT(timeout=2000)
while True:
b.on()
time.sleep_ms(150)
b.off()
time.sleep_ms(100)
b.on()
time.sleep_ms(150)
b.off()
time.sleep_ms(600)
if sw.value():
wdt.feed()