【发布时间】:2016-10-11 05:20:09
【问题描述】:
我的 NodeMCU 有问题,尝试在 esp8266 上启动 tmr.alarm。
tmr.alarm 从不启动计时器,并且总是返回 false。 我试过更改计时器,甚至更改闹钟的类型(自动、单次...),但我总是得到相同的结果。
这是代码的一部分,我尝试每 5 秒左右与 DS18B20(OneWire 温度传感器)通信一次。
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.
【问题讨论】:
-
您的代码与straight from the book 差不多,看起来还可以。您使用什么固件(版本、模块)?您是否有其他计时器正在运行,可能在同一个 ID 上?
-
没有其他计时器在运行,NodeMCU 版本 0.9.5 也许更新固件会很方便?