Since | Origin / Contributor | Maintainer | Source |
---|---|---|---|
2015-02-05 | Till Klocke | Till Klocke | ws2812.c |
Send GRB data in 8 bits to a WS2812 chain.
ws2812.writegrb(pin, string)
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)G2
, R2
, B2
are the next WS2812’s Green, Red, and Blue channel parametersnil
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
Send GRB data in 8bits to a WS2812 chain.
ws2812.writergb(pin, string)
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)R2
, G2
, B2
are the next WS2812’s Red, Green, and Blue channel parametersnil
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