Demand Peripherals     Robotics and Automation Made Easy

WS28: Quad WS2812 Interface

The WS28 peripheral lets you control four strings of up to 64 WS2812 style RGB(W) LEDs.



The gpio4 cards have 3.3 volt outputs which is not sufficient to drive the WS2812 LED directly. You need to add a level translator to get the output voltage up to the 4 volts required by the WS2812 LEDs. If your level translator inverts the signal you can invert the outputs of the WS2812 interface by setting the config value to 1.



led : which LED string to set and its value
The first parameter is which of the four LED strings to address and the second parameter is a sequence of hex characters to write to the string. The number of hex characters must be even since LEDs have 3 or 4 bytes of LED data. Use three bytes per LED for RGB and four bytes per LED for RGBW LEDs.

config : whether to invert the output or not
Set the config value to 1 to invert all four output signals. This may be needed if you level translator inverts the signal. The power up default is to have no inversion.



dpset ws28 config 1
dpset ws28 led 1 ffffffffffffffffffffffffffffffffffffffffffffffff
dpset ws28 led 4 111111111111111111111111111111111111111111111111
dpset ws28 led 4 00ff00ff00000000ff00ff00ff00000000ff00ff00ff0000