2016-06-10 109 views
0

我遇到了NodeMCU的问题,试图在esp8266上启动tmr.alarm。NodeMCU tmr.alarm始终返回false

tmr.alarm从不启动计时器,并始终返回false。 我试过改变计时器,甚至改变闹钟的类型(AUTO,SINGLE ...),但我总是有相同的结果。

这里是代码的一部分,我试图与DS18B20(OneWire温度传感器)每5秒钟左右交流一次。

if not tmr.alarm(1, 5000, tmr.ALARM_AUTO, function() 
     -- Comunication with the sensor 
    end) 
then print("Comunication with DS18B20 couldn't be started.") end 

输出始终

Comunication with DS18B20 couldn't be started. 
+0

你的代码非常[直接从书中](http://nodemcu.readthedocs.io/en/dev/en/modules/tmr/#tmralarm),看起来不错。你使用什么固件(版本,模块)?您是否有其他计时器正在运行,可能使用相同的ID? –

+0

没有其他定时器在运行,NodeMCU版本0.9.5 也许固件更新会很方便? – Crystallize

回答