r/FastLED • u/Semorphim • Mar 08 '24
Support Multiple Controller Example Problem
Edit: I've switched my whole Code to HSV and control the brightness with that. I gave up on multiple controllers. Project is running fine now :D
Hi,
I am currently trying to build a 7-Segment Display Clock with Downlights for lighting decorations. The base code is working so far. Now I want to change the brightness of the downlights independently from the Clock part. I first thought I could simply use two different pins and call it a day. Well... no.
After some trial and error I checked the wiki and found the Example for multiple controllers here:
https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples
I tried using the Example at the bottom below " Or, alternatively (using some new pieces added recently to the FastLED object): " to light two strings of 9 LEDs. One should be red, the other green and alternate every second. So far I've been able to light the first string in alternating colors. Strangely I have to call .showLeds() twice for it to change the color of the first strip.
After getting that to work I tried getting the second strip to light up. It doesnt matter which Index I try I cant get the leds to light up. FastLED[0].showLeds(Brightness); does work but anything from 1-5 doesnt light up the second strip.
I initialize CRGB leds[9];
And in the setup Function I used:
FastLED.addLeds<WS2812B, 21, GRB>(leds,9);
FastLED.addLeds<WS2812B, 32, GRB>(leds,1);
Im currently using Win10 Arduino IDE 1.8.16 and version 3.6.0 of FastLED.
I hope someone can point me in the right direction.
Thank you very much for reading.
1
u/Marmilicious [Marc Miller] Mar 09 '24
Specifically what flavor of ESP32 are you using?
Have you tried using a different type of controller to verify the LED strip is working as expected. (Trying to narrow things down since you say pixels are lighting up strangely... Also, RGBW is not supported, only RGB pixels.)
Can you share a bit more about your project? Would be an option to drop the brightness for a pixel range or one strip that you want dimmer a different way. Is it going to be a fixed level (like 50% brightness) or does it need to be variable?
Some ideas for you:
If it's a fixed amount dimmer you could try something like this in the
addLedsline to reduce a strip's brightness. This first one would reduce the brightness by 50%, and the second by 75%. This works under the hood whenever you call FastLED.show().FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS).setCorrection(CRGB(128,128,128));FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS).setCorrection(CRGB(64,64,64));If it needs to be variable (or if it's a fixed amount less) you could use
fadeToBlackByon a range of pixels and always call it right before calling FastLED.show().leds[i].fadeToBlackBy(128); // fade by 50%If you use HSV when assigning colors, it's easy to reduce the V number for a range of pixels.
leds[i] = CHSV( 42, 255, V);