From 75580f5dda30674c70da44ef92f8a753bf80cea6 Mon Sep 17 00:00:00 2001 From: devsaurus Date: Mon, 11 Jan 2016 22:36:25 +0100 Subject: [PATCH] transferred ws2812 module documentation --- docs/en/modules/ws2812.md | 53 +++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 54 insertions(+) create mode 100644 docs/en/modules/ws2812.md diff --git a/docs/en/modules/ws2812.md b/docs/en/modules/ws2812.md new file mode 100644 index 00000000..dbe01cae --- /dev/null +++ b/docs/en/modules/ws2812.md @@ -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 +``` diff --git a/mkdocs.yml b/mkdocs.yml index 2514cfd0..d1df6a52 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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'