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()
扫描二维码关注公众号,回复: 8183350 查看本文章

 

 提示:

其它 (硬延时 us)

延时 100us

tmr.delay(100)

注:不建议使用.

其它 (看门狗)

启用5S看门狗

tmr.softwd(5)

喂狗

tmr.wdclr()

猜你喜欢

转载自www.cnblogs.com/yangfengwu/p/12038009.html