1959 views|2 replies

96

Posts

0

Resources
The OP
 

Release a dog for esp8266 [Copy link]

 

The code is as follows:
  1. import machine as mc class WDOG(): def __init__(self): self.timer = mc.Timer(-1) self.fed = False def feed(self): self.fed = True def wdcb (self): pass def wdtcb(self,tmr): if not self.fed: mc.reset() self.fed = False self.wdcb() def init(self,msec=5000): self.timer.init( period=msec, mode=mc.Timer.PERIODIC, callback=self.wdtcb) self.feed() wd = WDOG() wd.init(20000) for i in range(100): wd.feed() time.sleep (1) print(i)
复制代码
This content is originally created by EEWORLD forum user youxinweizhi. If you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source[/ b]

Latest reply

Software watchdog?  Details Published on 2018-7-20 20:13
 
 

1w

Posts

25

Resources
2
 
Software watchdog?

Comments

Yes  Details Published on 2018-7-23 09:16
 
 
 

96

Posts

0

Resources
3
 
Yes
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list