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()

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM