Hello, can someone help me please with FastLED code? I need use this method:
#define CH1_DataPin 5
FastLED.addLeds<WS2812B, CH1_DataPin, GRB>(LedArray, 0, CH_1_LedCount);
as
uint8_t CH1_DataPin = 5;
FastLED.addLeds<WS2812B, CH1_DataPin, GRB>(LedArray, 0, CH_1_LedCount);
Because will need create pins with loop “For”. How i can use variables in addLeds method? Thanks.
PS. Sorry for my English.
You can’t - its part of how the library does its optimization’s that the PIN numbers have to be constant at compile time.
Perhaps if you explain what you are attempting to do, you may get a different solution to your approach.
Today found this solution (“SovaSet” data loads from SD card):
now can use different sets of settings from SD
Thanks all. And special thanks for this amazing library!
LedArray = new CRGB[SovaSet.LEDCount];
int startLED = 0;
for (size_t i = 0; i < SovaSet.PinsCount; i++)
{
switch (SovaSet.Pins[i].Number)
{
case 0:
FastLED.addLeds<WS2812B, 0, GRB>(LedArray, startLED, SovaSet.Pins[i].LedCount);
break;
case 2:
FastLED.addLeds<WS2812B, 2, GRB>(LedArray, startLED, SovaSet.Pins[i].LedCount);
break;
case 4:
FastLED.addLeds<WS2812B, 4, GRB>(LedArray, startLED, SovaSet.Pins[i].LedCount);
break;
case 5:
FastLED.addLeds<WS2812B, 5, GRB>(LedArray, startLED, SovaSet.Pins[i].LedCount);
break;
default:
break;
}
startLED += SovaSet.Pins[i].LedCount;
}