ws2812 模块的问题。 init() 为 nil,write() 不按记录工作

Problems with ws2812 module. init() is nil, write() does not work as documented

我正在试用带有 ESP8266 和 nodeMCU 固件的 Adafruit neopixel 阵列。

使用以下自定义构建:

NodeMCU custom build by frightanic.com
    branch: master
    commit: c8037568571edb5c568c2f8231e4f8ce0683b883
    SSL: false
    modules: bmp085,file,gpio,i2c,net,node,tmr,uart,wifi,ws2812
build built on: 2016-05-24 13:48
powered by Lua 5.1.4 on SDK 1.4.0

当我调用 ws2812.init() 时,这是我在 ESPlorer 中得到的:

> ws2812.init();
stdin:1: attempt to call field 'init' (a nil value)
stack traceback:
    stdin:1: in main chunk

调用 ws2812.write() 时,我得到以下输出:

> ws2812.write(string.char(255,0,0,255,0,0));
stdin:1: bad argument #1 to 'write' (number expected, got string)
stack traceback:
    [C]: in function 'write'
    stdin:1: in main chunk

看起来,模块 ws2812 以任何形式存在,但具有不同的签名,如文档所述 (https://nodemcu.readthedocs.io/en/dev/en/modules/ws2812/)。

有什么想法吗? 谢谢,格尔德

你显然用 http://nodemcu-build.com/ 构建了你的固件(免责声明:这是我的网站)。它允许您 select 一个 NodeMCU 固件分支,当前 masterdev

您发布的文档 link 适用于 dev 分支 (/en/dev/en/modules/...)。 RTD 会自动将您转到 dev 分支,因为我们修改后的文档尚未在 master 分支中。如果您关心该进展,您可能想要关注 https://github.com/nodemcu/nodemcu-firmware/issues/1146

因此,只需从 dev 分支获取固件即可。