Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
1ab8f526
Commit
1ab8f526
authored
Apr 27, 2017
by
devsaurus
Browse files
fix ws2812 doc
parent
b7fa8c59
Changes
2
Hide whitespace changes
Inline
Side-by-side
components/modules/ws2812.c
View file @
1ab8f526
...
@@ -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
...
...
docs/en/modules/ws2812.md
View file @
1ab8f526
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment