Skip to content

Two channel WS2812 #456

Closed
Closed

Description

@CLMNTDSGNR

Good evening,

I am a little lost in my code, I know what I want but I have trouble coding it.

Here I have two ribbons WS2812 on the same channel. I would like to add another 2 pixels on channel 2 but the worry is that the data once passed through channel 1 if I plug my additional 2 pixels, I have color problems, bad colors, blinking ..

Channel 1 (pin 2) my two ribbons
Channel 2 (pin 6) my two pixels

The whole thing must work with hyperion (the rest of the code)

Here is my code beginning:

#include "FastLED.h"

// How many leds in your strip?
#define NUM_LEDS_ALL 6

#define NUM_LEDS_CH1 4
#define CH1_DATA_PIN 2

#define NUM_LEDS_CH2 2
#define CH2_DATA_PIN 6

// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN

#define CLOCK_PIN 13

#define COLOR_ORDER GRB

// Adalight sends a "Magic Word" (defined in /etc/boblight.conf) before sending the pixel data
uint8_t prefix[] = {'A', 'd', 'a'}, hi, lo, chk, i;

// Baudrate, higher rate allows faster refresh rate and more LEDs (defined in /etc/boblight.conf)
#define serialRate 460800

// Define the array of leds
CRGB channelOne[NUM_LEDS_CH1];
CRGB channelTwo[NUM_LEDS_CH2];

void setup() {
FastLED.addLeds<WS2812B, CH1_DATA_PIN, GRB>(channelOne, NUM_LEDS_CH1);
FastLED.addLeds<WS2812B, CH2_DATA_PIN, GRB>(channelTwo, NUM_LEDS_CH2);

 // initial RGB flash
 LEDS.showColor(CRGB(255, 0, 0));
 delay(5000);
 LEDS.showColor(CRGB(0, 255, 0));
 delay(5000);
 LEDS.showColor(CRGB(0, 0, 255));
 delay(5000);
 LEDS.showColor(CRGB(0, 0, 0));
   
 Serial.begin(serialRate);
 Serial.print("Ada\n"); // Send "Magic Word" string to host

}

void loop() {
/*
// wait for first byte of Magic Word
for(i = 0; i < sizeof prefix; ++i) {
waitLoop: while (!Serial.available()) ;;
// Check next byte in Magic Word
if(prefix[i] == Serial.read()) continue;
// otherwise, start over
i = 0;
goto waitLoop;
}

// Hi, Lo, Checksum

while (!Serial.available()) ;;
hi=Serial.read();
while (!Serial.available()) ;;
lo=Serial.read();
while (!Serial.available()) ;;
chk=Serial.read();

// if checksum does not match go back to wait
if (chk != (hi ^ lo ^ 0x55))
{
i=0;
goto waitLoop;
}

memset(leds, 0, NUM_LEDS_ALL * sizeof(struct CRGB));
// read the transmission data and set LED values
for (uint8_t i = 0; i < NUM_LEDS_ALL; i++) {
byte r, g, b;
while(!Serial.available());
r = Serial.read();
while(!Serial.available());
g = Serial.read();
while(!Serial.available());
b = Serial.read();
leds[i].r = r;
leds[i].g = g;
leds[i].b = b;
}
*/
// shows new values
FastLED.show();
}

Thank you

Activity

  1. jasoncoon commented on May 30, 2017

    @jasoncoon
    Member

    Hello! This issue tracker is for bugs with the library. For general help, please read through the Frequently Asked Questions, and then post in the FastLED community, as mentioned in the Getting Help section.

  2. added a commit that references this issue on Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions