Hello - thank you for any help you can provide to my situation below!
I would like to run two strips of LEDs from a single Arduino, with independent brightness control. My understanding is that FastLED.show uses a global brightness setting and I would need to use CLEDController showLeds(); in order to have the independent brightness control. I am using the example at the very bottom of this section as a reference.
Here is what I want the first strip of LEDs to look like. This is with the global brightness and FastLED.show function:
I then want a second strip I can add elsewhere which can have a dynamic brightness... sometimes it will be a low brightness and occasionally it will flash very brightly. All the while, this 20x10 matrix will stay the same brightness just like in the picture above.
If there is a solution I am not considering, or if you have tips on how to correct this approach, please let me know! Below is more info on what I have tried and what the result is.
When I try to manage this with CLEDcontroller to prepare for multiple controllers in the future, the Brightness setting is disrupting the color of the LEDs. At a low Brightness setting, every other LED is a different color:
At a high brightness setting, the lights do not flicker or alternate, but they are much too bright. And if I use .setCorrection(CRGB(x,y,z); to dim them to the brightness I want, they go back to the flickering and alternating pattern above.
Here is the individual controller code:
#include <FastLED.h>
// SID LED intialization
#define NUM_LEDS 200 // How many leds are in the strip?
#define SID_DATA_PIN 7
#define CLOCK_PIN 13 // not needed?
#define BRIGHTNESS 255
#define GREEN 255,50,50 //this board does color in GRB, not RGB
#define YELLOW 103,255,30 //this board does color in GRB, not RGB
#define RED 23,255,0 //this board does color in GRB, not RGB
int rows;
int columnArray[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int ledMatrix[10][20] = {
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19},
{39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20},
{40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59},
{79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60},
{80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99},
{119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100},
{120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139},
{159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140},
{160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179},
{199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180}
};
CRGB SIDleds[NUM_LEDS];
CRGB Secondleds[10];
void setup() {
FastLED.addLeds<WS2811, SID_DATA_PIN, RGB>(SIDleds, NUM_LEDS).setCorrection(CRGB(10,15,10));
FastLED.addLeds<WS2811, 8, RGB>(Secondleds, 1);
FastLED.addLeds<WS2811, 6, RGB>(Thirdleds, 1);
FastLED.setMaxPowerInVoltsAndMilliamps(5, 500);
FastLED.clear();
FastLED.setBrightness(BRIGHTNESS);
}
void loop() {
rows = 19;
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 13; y++) {
SIDleds[ledMatrix[x][y]] = CRGB(GREEN);
}
}
for (int x = 0; x < 10; x++) {
for (int y = 13; y < 19; y++) {
SIDleds[ledMatrix[x][y]] = CRGB(YELLOW);
}
}
for (int x = 0; x < 10; x++) {
for (int y = rows; y < rows + 1; y++) {
SIDleds[ledMatrix[x][y]] = CRGB(RED);
}
}
FastLED[0].showLeds(BRIGHTNESS);
}
And here is the original code which has the desired behavior, but would not allow me to add a new LED string with its own brightness:
#include <FastLED.h>
// SID LED intialization
#define NUM_LEDS 200 // How many leds are in the strip?
#define SID_DATA_PIN 7
#define CLOCK_PIN 13 // not needed?
#define BRIGHTNESS 5
#define GREEN 255,50,50 //this board does color in GRB, not RGB
#define YELLOW 103,255,30 //this board does color in GRB, not RGB
#define RED 23,255,0 //this board does color in GRB, not RGB
int rows;
int columnArray[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int arrayPosition = 0;
int ledMatrix[10][20] = {
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19},
{39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20},
{40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59},
{79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60},
{80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99},
{119, 118, 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100},
{120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139},
{159, 158, 157, 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 141, 140},
{160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179},
{199, 198, 197, 196, 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, 183, 182, 181, 180}
};
CRGB SIDleds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2811, SID_DATA_PIN, RGB>(SIDleds, NUM_LEDS);
FastLED.setMaxPowerInVoltsAndMilliamps(5, 500);
FastLED.clear();
FastLED.setBrightness(BRIGHTNESS);
}
void loop() {
rows = 19;
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 13; y++) {
SIDleds[ledMatrix[x][y]] = CRGB(GREEN);
}
}
for (int x = 0; x < 10; x++) {
for (int y = 13; y < 19; y++) {
SIDleds[ledMatrix[x][y]] = CRGB(YELLOW);
}
}
for (int x = 0; x < 10; x++) {
for (int y = rows; y < rows + 1; y++) {
SIDleds[ledMatrix[x][y]] = CRGB(RED);
}
}
FastLED.show();
}