NodeMCU - Lua 和 si7021

有人能在 ESP8266 板上使用 Lua 脚本和 si7021 吗?

http://nodemcu.readthedocs.io/en/master/en/modules/si7021/#si7021setup

我总是得到以下异常:

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 27228, room 16
tail 12
chksum 0x76
ho 0 tail 12 room 4
load 0x3ffe8000, len 2184, room 12
tail 12
chksum 0xc2
ho 0 tail 12 room 4
load 0x3ffe8888, len 136, room 12
tail 12
chksum 0x16
csum 0x16

这是我使用的代码片段:

function initSTH()
    print("初始化 i2c")
    i2c.setup(0, 5, 6, i2c.SLOW) -- 仅调用 i2c.setup() 一次

    print("初始化 si7021")
    si7021.setup()

    print("配置它")
    res, vdds, heater, heater_set = si7021.setting(si7021.RH12_TEMP14)

    print("res: " .. res .. "vdds: " .. vdds .. "heater: " .. heater .. "heater_set: " .. heater_set )
end
点赞