ESP8266 LUA脚本语言开发: 外设篇-定时器,延时,看门狗

 

 

 

 https://nodemcu.readthedocs.io/en/master/modules/tmr/

 

 

 

 

local mytimer1 = tmr.create() 

function TimeFunction1()
    print("1S 循环定时器")
end

mytimer1:register(1000, 1, TimeFunction1)

mytimer1:start()



local mytimer2 = tmr.create() 

function TimeFunction2()
    print("1S 一次定时器")
end

mytimer2:register(1000, 0, TimeFunction2)

mytimer2:start()

 

 

 

 

 

 提示:

 

 

 

 

其它 (硬延时 us)

 

 

 

延时 100us

 

tmr.delay(100)

 

注:不建议使用.

 

其它 (看门狗)

 

 

 

 

 

启用5S看门狗

tmr.softwd(5)

 

 

喂狗

tmr.wdclr()

 

 

posted on 2019-12-14 01:55  广源时代  阅读(1823)  评论(0编辑  收藏  举报

导航

支付宝 QQ群