transferred ws2812 module documentation

This commit is contained in:
devsaurus 2016-01-11 22:36:25 +01:00
parent 4878abc0bb
commit 75580f5dda
2 changed files with 54 additions and 0 deletions

53
docs/en/modules/ws2812.md Normal file
View File

@ -0,0 +1,53 @@
# WS2812 Module
## ws2812.write()
Send GRB data in 8 bits to a WS2812 chain.
#### Syntax
`ws2812.writegrb(pin, string)`
#### Parameters
- `pin` any GPIO pin 0, 1, 2, ...
- `string` payload to be sent to one or more WS2812 LEDs.
It should be composed from a GRB triplet per element.
- `G1` the first pixel's Green channel (0-255)
- `R1` the first pixel's Red channel (0-255)
- `B1` the first pixel's Blue channel (0-255)
... You can connect a lot of WS2812 ...
- `G2`, `R2`, `B2` are the next WS2812's Green, Red, and Blue channel parameters
#### Returns
`nil`
```lua
g = 0
r = 255
b = 0
leds_grb = string.char(g,r,b, g,r,b)
ws2812.write(2, leds_grb) -- turn two WS2812Bs to red, connected to pin 2
```
## ws2812.writergb()
Send GRB data in 8bits to a WS2812 chain.
#### Syntax
`ws2812.writergb(pin, string)`
#### Parameters
- `pin` any GPIO pin 0, 1, 2, ...
- `string` payload to be sent to one or more WS2812 LEDs.
It should be composed from an RGB triplet per element.
- `R1` the first pixel's Red channel (0-255)
- `G1` the first pixel's Green channel (0-255)
- `B1` the first pixel's Blue channel (0-255)
... You can connect a lot of WS2812 ...
- `R2`, `G2`, `B2` are the next WS2812's Red, Green, and Blue channel parameters
#### Returns
`nil`
#### Example
```lua
leds_rgb = string.char(255,0,0, 0,255,0, 0,0,255)
ws2812.writergb(2, leds_rgb) -- turn three WS2812Bs to red, green, and blue respectively
```

View File

@ -51,5 +51,6 @@ pages:
- 'u8g': 'en/modules/u8g.md'
- 'uart': 'en/modules/uart.md'
- 'ucg': 'en/modules/ucg.md'
- 'ws2812': 'en/modules/ws2812'
- Deutsch:
- Home: 'de/index.md'