Fills the device LEDs with a repeative color pattern.
fill-pattern
@/fill-pattern
Fills the device LEDs with a repeative color pattern.
DEV@/ws2812-device
The device
PAT@/color-pattern
The color pattern. If the pattern is shorter than the number of LEDs it repeats.
SHFTnumber
The number of pixels to shift/wrap in the pattern. It should be an integer. If it is negative or greater than the pattern length the shift is wrapped over. Use shift to create a crawler animation.
DOpulse
Trigger to fill pixels of the device with the pattern
DONEpulse
Fires when the fill is done
DEV'@/ws2812-device
The device
To use the node in your project you should have the xod-dev/ws2812 library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.
C++ implementation
node {
void evaluate(Context ctx) {
auto dev = getValue<input_DEV>(ctx);
if (isInputDirty<input_DO>(ctx)) {
auto pat = getValue<input_PAT>(ctx);
uint32_t shift = (uint32_t)getValue<input_SHFT>(ctx);
dev->fillPattern(pat, shift);
}
emitValue<output_DEVU0027>(ctx, dev);
}
}