Updated README.md with instructions for the ws2812 module

This commit is contained in:
Till Klocke 2015-02-05 19:04:09 +01:00
parent 284ee8c46e
commit c5d83590bd
1 changed files with 11 additions and 0 deletions

View File

@ -125,6 +125,7 @@ pre_build/latest/nodemcu_512k_latest.bin is removed. use pre_build/latest/nodemc
#define LUA_USE_MODULES_UART #define LUA_USE_MODULES_UART
#define LUA_USE_MODULES_OW #define LUA_USE_MODULES_OW
#define LUA_USE_MODULES_BIT #define LUA_USE_MODULES_BIT
#define LUA_USE_MODULES_WS2812
#endif /* LUA_USE_MODULES */ #endif /* LUA_USE_MODULES */
... ...
// LUA_NUMBER_INTEGRAL // LUA_NUMBER_INTEGRAL
@ -329,3 +330,13 @@ cu:send("hello")
ds18b20 = nil ds18b20 = nil
package.loaded["ds18b20"]=nil package.loaded["ds18b20"]=nil
``` ```
####Control a WS2812 based light strip
```lua
-- set the color of one LED on GPIO 2 to red
ws2812.write(4, string.char(0, 255, 0))
-- set the color of 10 LEDs on GPIO 0 to blue
ws2812.write(3, string.char(0, 0, 255):rep(10))
-- first LED green, second LED white
ws2812.write(4, string.char(255, 0, 0, 255, 255, 255))
```