FastLED two modes from two strips overlap

Hi, recently I've been playing around with ESP8266, two LED strips, FastLED library and I came across a problem. Well, I wanted to create a project in which two different LED strips connected to different outputs would light two different light modes. Unfortunately, the two modes started to overlap. So I used the clearLedData() function. The modes stopped overlapping however they look different than they should. It looks like adding a black fill, to a working mode. Someone may know how to deal with this problem? I attach my code below.

#include <FastLED.h>
#define NUM_LEDS 60
#define DATA_PIN1 4
#define DATA_PIN2 2

CRGB leds[NUM_LEDS];
uint8_t h = 0;

#define NUM_STRIPS 2
CLEDController *controllers[NUM_STRIPS];

void setup() {

controllers[0] = &FastLED.addLeds<WS2812B, DATA_PIN1, GRB>(leds, NUM_LEDS);

controllers[1] = &FastLED.addLeds<WS2812B, DATA_PIN2, GRB>(leds, NUM_LEDS);

}

void loop() {

uint8_t p = map(beat8(40,0), 0, 255, 0, NUM_LEDS - 1);
leds[p] = CHSV(h, 200, 255);
fadeToBlackBy(leds, NUM_LEDS, 3);
EVERY_N_MILLISECONDS(1)
{
h ++;
}

controllers[0]->showLeds();
controllers[0]->clearLedData ();

uint8_t A2 = beatsin8(25, 0, NUM_LEDS +1, 0, 0);
uint8_t B2 = beatsin8(50, 0, NUM_LEDS +1, 0, 0);
uint8_t C2 = beatsin8(20, 0, 255, 0, 0);
leds[(A2+B2)/2] = CHSV(C2, 255, 255);
fadeToBlackBy(leds, NUM_LEDS, 10);
controllers[1]->showLeds();
controllers[1]->clearLedData();
}

If you want to have two independent strips, you must allocate separate pixel array for each.
But you defined only one and try to use the same array to both strips:

Wow, thank you!!! How did I not notice that? Now everything is working.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.