1.1 KiB
1.1 KiB
PixelStream Example
This example demonstrates how to consume the udp/raw cluster event and drive a NeoPixel strip or matrix directly from streamed RGB data. Frames are provided as hex encoded byte triplets (RRGGBB per pixel).
Features
- Subscribes to
udp/rawviaNodeContext::on. - Converts incoming frames into pixel colors for strips or matrices.
- Supports serpentine (zig-zag) matrix wiring.
Payload Format
Each packet is expected to be RAW: followed by pixelCount * 3 * 2 hexadecimal characters. For example, for 8 pixels:
RAW:FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000FF0000
Usage
Strip Mode
Upload the example with PIXEL_MATRIX_WIDTH set to 0 (default). Send frames containing PIXEL_COUNT * 3 bytes as hex.
Matrix Mode
Set PIXEL_MATRIX_WIDTH to the number of columns. The controller remaps even/odd rows to support serpentine wiring.
Configuration
Adjust PIXEL_PIN, PIXEL_COUNT, PIXEL_BRIGHTNESS, PIXEL_MATRIX_WIDTH, PIXEL_MATRIX_SERPENTINE, and PIXEL_TYPE through build defines or editing main.cpp.