File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 49
49
//| w.timeout=2.5 # Set a timeout of 2.5 seconds
50
50
//| w.mode = WatchDogMode.RAISE
51
51
//| w.feed()"""
52
+
53
+ //| class WatchDogTimeout(Exception):
54
+ //| """Exception raised when the watchdog timer is set to
55
+ //| ``WatchDogMode.RAISE`` and expires.
56
+ //|
57
+ //| Example::
58
+ //|
59
+ //| import microcontroller
60
+ //| import watchdog
61
+ //| import time
62
+ //|
63
+ //| wdt = microcontroller.watchdog
64
+ //| wdt.timeout = 5
65
+ //|
66
+ //| while True:
67
+ //| wdt.mode = watchdog.WatchDogMode.RAISE
68
+ //| print("Starting loop -- should exit after five seconds")
69
+ //| try:
70
+ //| while True:
71
+ //| time.sleep(10) # Also works with pass
72
+ //| except watchdog.WatchDogTimeout as e:
73
+ //| print("Watchdog expired")
74
+ //| except Exception as e:
75
+ //| print("Other exception")
52
76
//|
77
+ //| print("Exited loop")
78
+ //| """
53
79
54
80
const mp_obj_type_t mp_type_WatchDogTimeout = {
55
81
{ & mp_type_type },
You can’t perform that action at this time.
0 commit comments