Commit 1ab8f526 authored by devsaurus's avatar devsaurus
Browse files

fix ws2812 doc

parent b7fa8c59
...@@ -36,6 +36,9 @@ static int ws2812_write( lua_State* L ) ...@@ -36,6 +36,9 @@ static int ws2812_write( lua_State* L )
int top = lua_gettop( L ); int top = lua_gettop( L );
for (int stack = 1; stack <= top; stack++) { for (int stack = 1; stack <= top; stack++) {
if (lua_type( L, stack ) == LUA_TNIL)
continue;
if (lua_type( L, stack ) != LUA_TTABLE) { if (lua_type( L, stack ) != LUA_TTABLE) {
ws2812_cleanup( L, 0 ); ws2812_cleanup( L, 0 );
luaL_checktype( L, stack, LUA_TTABLE ); // trigger error luaL_checktype( L, stack, LUA_TTABLE ); // trigger error
......
...@@ -7,15 +7,13 @@ ws2812 is a library to handle ws2812-like led strips. ...@@ -7,15 +7,13 @@ ws2812 is a library to handle ws2812-like led strips.
It works at least on WS2812, WS2812b, APA104, SK6812 (RGB or RGBW). It works at least on WS2812, WS2812b, APA104, SK6812 (RGB or RGBW).
## ws2812.write() ## ws2812.write()
Send data to one or two led strip using its native format which is generally Green,Red,Blue for RGB strips Send data to up to 8 led strip using its native format which is generally Green,Red,Blue for RGB strips and Green,Red,Blue,White for RGBW strips.
and Green,Red,Blue,White for RGBW strips.
#### Syntax #### Syntax
`ws2812.write(array)` `ws2812.write(table, ...)`
#### Parameters #### Parameters
Array containing an element for each chain (maximum of 8 elements): Variable number of tables, each describing a single strip. Required elements are:
- `pin` 0 ~ 33, I/O index - `pin` 0 ~ 33, I/O index
- `data` payload to be sent to one or more WS2812 like leds through GPIO2 - `data` payload to be sent to one or more WS2812 like leds through GPIO2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment