forkineye / E131

E1.31 (sACN) library for Arduino with ESP8266 support
127 stars 44 forks source link

RGBW? #15

Closed gerwitz closed 5 years ago

gerwitz commented 7 years ago

Has anyone tried adapting the NeoPixel example (or ESPixelStick) for RGBW strips (SK6812RGBW)?

Aircoookie commented 5 years ago

I notice this issue is over a year old, but if anyone has the same question, the solution should be quite straightforward. Just have your source send 4 channels/pixel and use code along these lines:

void loop() {
    /* Parse a packet and update pixels */
    if(e131.parsePacket()) {
        if (e131.universe == UNIVERSE) {
            for (int i = 0; i < NUM_PIXELS; i++) {
                int j = i * 4 + (CHANNEL_START - 1);
                pixels.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2], e131.data[j+3]); //rgbw
            }
            pixels.show();
        }
    }
}