https://docs.micropython.org/en/latest/ ... e.WDT.html
Code: Select all
import machine
WD = machine.WDT(timeout=2000)
TypeError: function doesn't take keyword arguments
WD = machine.WDT(0, 2000)
TypeError: function expected at most 1 arguments, got 2
WD = machine.WDT(2000)
ValueError:
Code: Select all
# software watchdog, to prevent ESP freezing
class TWDog:
def __init__(self, aID: int, aTOut: int):
self._TOut = aTOut
self._Cnt = 0
Timer = machine.Timer(aID)
Timer.init(period = int(1 * 1000), mode = machine.Timer.PERIODIC, callback = self._CallBack)
def _CallBack(self, aTimer):
self._Cnt += 1
if (self._Cnt >= self._TOut):
print("WDT timeout")
aTimer.deinit()
machine.reset()
def Feed(self):
self._Cnt = 0
WDog = TWDog(0, 60)