From 003a8784d215d16a1f659b3f4a83e128595579ae Mon Sep 17 00:00:00 2001 From: draxaris1010 Date: Fri, 7 Jun 2024 13:11:14 +0200 Subject: [PATCH] vinscant: added watchdog timer --- vinscant/main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vinscant/main.py b/vinscant/main.py index cddf07e..6af048a 100644 --- a/vinscant/main.py +++ b/vinscant/main.py @@ -1,6 +1,6 @@ import mfrc522 import urequests as req -from machine import Pin, PWM +from machine import Pin, PWM, WDT import time from neopixel import NeoPixel @@ -109,11 +109,17 @@ def do_read(): print("Authentication error") notifier.error() notifier.idle() + watchdog.feed() except KeyboardInterrupt: print("KeyboardInterrupt") + return notifier = StatusNotifier(Buzzer(Pin(37, Pin.OUT)), Led()) notifier.idle() key = get_key() +print("vinscant: watchdog starting in 2s, interupt now with Ctrl+C") +time.sleep(2) +watchdog = WDT(timeout=10 * 1000) +print("vinscant: watchdog started") do_read()