Question: I want to use a single source code set which calls FastLed for

Question:

I want to use a single source code set which calls FastLed for a different installations that contain different numbers of leds.

I don’t want to have to set the number of leds and recompile for each installation. I want to read the number of leds from eeProm.

LEDS.addLeds takes a constant.

Is there anyway around this?
For example, the creation of the leds array could be set to a maximum of all the installations as long as LEDS.show(); only output to a specified (non-compile time) variable number of leds.

thanks,
Richard

As I recall, you can’t change the addLeds with an EEPROM value, so I called it MAX_LEDS, and then read the REAL length from EEPROM in setup as follows:

#define STRANDLEN 1 // Defined before the setup routine

// This was IN the setup routine
NUM_LEDS = EEPROM.read(STRANDLEN); if(NUM_LEDS >MAX_LEDS) NUM_LEDS = MAX_LEDS; // Location 1 is the number of LED’s

I then used the updated NUM_LEDS value in the loop.

I also have additional code in the loop to read commands from an IR transmitter to allow me to write the STRANDLEN value to EEPROM as follows:

case 64260: EEPROM.write(STRANDLEN,NUM_LEDS); Serial.print(“Writing: “); Serial.print(NUM_LEDS); Serial.println(” LEDs”); break; //b1 - Write the current # of LED’s
case 64005: NUM_LEDS–; Serial.print("NUM_LEDS: "); Serial.println(NUM_LEDS); fill_solid(leds,MAX_LEDS,CRGB(0,0,0)); fill_solid(leds,NUM_LEDS,CRGB(255,255,255)); break; //b2 - Decrease # of LED’s
case 63750: NUM_LEDS++; Serial.print("NUM_LEDS: "); Serial.println(NUM_LEDS); fill_solid(leds,MAX_LEDS,CRGB(0,0,0)); fill_solid(leds,NUM_LEDS,CRGB(255,255,255)); break; //b3 - Increase # of LED’s

I used the “Search Community” box on the left and found quite a few conversations on this topic:

https://plus.google.com/u/0/116225765652479729260/posts/fK4xdrfdo8Q
https://plus.google.com/u/0/+AndrewTuline/posts/StPh9UcxX78
https://plus.google.com/u/0/103598531290170183719/posts/ggqe8eX6nHR
https://plus.google.com/u/0/+MatthewEvansFPV/posts/Dw5qq2F2eSA