SO i am trying to make a led controller with the fastled library where the user can input wich led type they have and wich RGB arrangnement the led has.
So i did try this and it worked.
void setFastled()
{
String lt = ledType;
if (lt == "WS2812B") {
ws2812B ();
}
void ws2812B ()
{
String la = ledArrange;
if (la == "RGB") {
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, LED_NUMBER);
} else if (la == "RBG") {
FastLED.addLeds<WS2812B, DATA_PIN, RBG>(leds, LED_NUMBER);
} else if (la == "GRB") {
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, LED_NUMBER);
} else if (la == "GBR") {
FastLED.addLeds<WS2812B, DATA_PIN, GBR>(leds, LED_NUMBER);
} else if (la == "BRG") {
FastLED.addLeds<WS2812B, DATA_PIN, BRG>(leds, LED_NUMBER);
} else if (la == "BGR") {
FastLED.addLeds<WS2812B, DATA_PIN, BGR>(leds, LED_NUMBER);
}
FastLED.setMaxPowerInVoltsAndMilliamps(5, LED_LIMIT_MILLIAMPS);
}
But when i do add a few more.
void setFastled()
{
String lt = ledType;
if (lt == "WS2812B") {
ws2812 ();
}
if (lt == "WS2812") {
ws2812 ();
}
if (lt == "WS2811") {
ws2811 ();
}
if (lt == "WS2811_400") {
ws2811_400 ();
}
if (lt == "SM16703") {
sm16703 ();
}
if (lt == "TM1829") {
tm1829 ();
}
if (lt == "TM1812") {
tm1812 ();
}
if (lt == "TM1809") {
tm1809 ();
}
if (lt == "TM1804") {
tm1804 ();
}
}
void ws2812B ()
{
String la = ledArrange;
if (la == "RGB") {
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, LED_NUMBER);
} else if (la == "RBG") {
FastLED.addLeds<WS2812B, DATA_PIN, RBG>(leds, LED_NUMBER);
} else if (la == "GRB") {
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, LED_NUMBER);
} else if (la == "GBR") {
FastLED.addLeds<WS2812B, DATA_PIN, GBR>(leds, LED_NUMBER);
} else if (la == "BRG") {
FastLED.addLeds<WS2812B, DATA_PIN, BRG>(leds, LED_NUMBER);
} else if (la == "BGR") {
FastLED.addLeds<WS2812B, DATA_PIN, BGR>(leds, LED_NUMBER);
}
FastLED.setMaxPowerInVoltsAndMilliamps(5, LED_LIMIT_MILLIAMPS);
}
void ws2812 ()
{
String la = ledArrange;
if (la == "RGB") {
FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, LED_NUMBER);
} else if (la == "RBG") {
FastLED.addLeds<WS2812, DATA_PIN, RBG>(leds, LED_NUMBER);
} else if (la == "GRB") {
FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, LED_NUMBER);
} else if (la == "GBR") {
FastLED.addLeds<WS2812, DATA_PIN, GBR>(leds, LED_NUMBER);
} else if (la == "BRG") {
FastLED.addLeds<WS2812, DATA_PIN, BRG>(leds, LED_NUMBER);
} else if (la == "BGR") {
FastLED.addLeds<WS2812, DATA_PIN, BGR>(leds, LED_NUMBER);
}
FastLED.setMaxPowerInVoltsAndMilliamps(5, LED_LIMIT_MILLIAMPS);
}
void ws2811()
{
String la = ledArrange;
if (la == "RGB") {
FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, LED_NUMBER);
} else if (la == "RBG") {
FastLED.addLeds<WS2811, DATA_PIN, RBG>(leds, LED_NUMBER);
} else if (la == "GRB") {
FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, LED_NUMBER);
} else if (la == "GBR") {
FastLED.addLeds<WS2811, DATA_PIN, GBR>(leds, LED_NUMBER);
} else if (la == "BRG") {
FastLED.addLeds<WS2811, DATA_PIN, BRG>(leds, LED_NUMBER);
} else if (la == "BGR") {
FastLED.addLeds<WS2811, DATA_PIN, BGR>(leds, LED_NUMBER);
}
FastLED.setMaxPowerInVoltsAndMilliamps(5, LED_LIMIT_MILLIAMPS);
}
void ws2811_400()
{
String la = ledArrange;
if (la == "RGB") {
FastLED.addLeds<WS2811_400, DATA_PIN, RGB>(leds, LED_NUMBER);
} else if (la == "RBG") {
FastLED.addLeds<WS2811_400, DATA_PIN, RBG>(leds, LED_NUMBER);
} else if (la == "GRB") {
FastLED.addLeds<WS2811_400, DATA_PIN, GRB>(leds, LED_NUMBER);
} else if (la == "GBR") {
FastLED.addLeds<WS2811_400, DATA_PIN, GBR>(leds, LED_NUMBER);
} else if (la == "BRG") {
FastLED.addLeds<WS2811_400, DATA_PIN, BRG>(leds, LED_NUMBER);
} else if (la == "BGR") {
FastLED.addLeds<WS2811_400, DATA_PIN, BGR>(leds, LED_NUMBER);
}
FastLED.setMaxPowerInVoltsAndMilliamps(12, LED_LIMIT_MILLIAMPS);
}
void sm16703()
{
String la = ledArrange;
if (la == "RGB") {
FastLED.addLeds<SM16703, DATA_PIN, RGB>(leds, LED_NUMBER);
} else if (la == "RBG") {
FastLED.addLeds<SM16703, DATA_PIN, RBG>(leds, LED_NUMBER);
} else if (la == "GRB") {
FastLED.addLeds<SM16703, DATA_PIN, GRB>(leds, LED_NUMBER);
} else if (la == "GBR") {
FastLED.addLeds<SM16703, DATA_PIN, GBR>(leds, LED_NUMBER);
} else if (la == "BRG") {
FastLED.addLeds<SM16703, DATA_PIN, BRG>(leds, LED_NUMBER);
} else if (la == "BGR") {
FastLED.addLeds<SM16703, DATA_PIN, BGR>(leds, LED_NUMBER);
}
FastLED.setMaxPowerInVoltsAndMilliamps(24, LED_LIMIT_MILLIAMPS);
}
void tm1829()
{
String la = ledArrange;
if (la == "RGB") {
FastLED.addLeds<TM1829, DATA_PIN, RGB>(leds, LED_NUMBER);
} else if (la == "RBG") {
FastLED.addLeds<TM1829, DATA_PIN, RBG>(leds, LED_NUMBER);
} else if (la == "GRB") {
FastLED.addLeds<TM1829, DATA_PIN, GRB>(leds, LED_NUMBER);
} else if (la == "GBR") {
FastLED.addLeds<TM1829, DATA_PIN, GBR>(leds, LED_NUMBER);
} else if (la == "BRG") {
FastLED.addLeds<TM1829, DATA_PIN, BRG>(leds, LED_NUMBER);
} else if (la == "BGR") {
FastLED.addLeds<TM1829, DATA_PIN, BGR>(leds, LED_NUMBER);
}
FastLED.setMaxPowerInVoltsAndMilliamps(5, LED_LIMIT_MILLIAMPS);
}
void tm1812()
{
String la = ledArrange;
if (la == "RGB") {
FastLED.addLeds<TM1812, DATA_PIN, RGB>(leds, LED_NUMBER);
} else if (la == "RBG") {
FastLED.addLeds<TM1812, DATA_PIN, RBG>(leds, LED_NUMBER);
} else if (la == "GRB") {
FastLED.addLeds<TM1812, DATA_PIN, GRB>(leds, LED_NUMBER);
} else if (la == "GBR") {
FastLED.addLeds<TM1812, DATA_PIN, GBR>(leds, LED_NUMBER);
} else if (la == "BRG") {
FastLED.addLeds<TM1812, DATA_PIN, BRG>(leds, LED_NUMBER);
} else if (la == "BGR") {
FastLED.addLeds<TM1812, DATA_PIN, BGR>(leds, LED_NUMBER);
}
FastLED.setMaxPowerInVoltsAndMilliamps(12, LED_LIMIT_MILLIAMPS);
}
void tm1809()
{
String la = ledArrange;
if (la == "RGB") {
FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, LED_NUMBER);
} else if (la == "RBG") {
FastLED.addLeds<TM1809, DATA_PIN, RBG>(leds, LED_NUMBER);
} else if (la == "GRB") {
FastLED.addLeds<TM1809, DATA_PIN, GRB>(leds, LED_NUMBER);
} else if (la == "GBR") {
FastLED.addLeds<TM1809, DATA_PIN, GBR>(leds, LED_NUMBER);
} else if (la == "BRG") {
FastLED.addLeds<TM1809, DATA_PIN, BRG>(leds, LED_NUMBER);
} else if (la == "BGR") {
FastLED.addLeds<TM1809, DATA_PIN, BGR>(leds, LED_NUMBER);
}
FastLED.setMaxPowerInVoltsAndMilliamps(12, LED_LIMIT_MILLIAMPS);
}
void tm1804()
{
String la = ledArrange;
if (la == "RGB") {
FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, LED_NUMBER);
} else if (la == "RBG") {
FastLED.addLeds<TM1804, DATA_PIN, RBG>(leds, LED_NUMBER);
} else if (la == "GRB") {
FastLED.addLeds<TM1804, DATA_PIN, GRB>(leds, LED_NUMBER);
} else if (la == "GBR") {
FastLED.addLeds<TM1804, DATA_PIN, GBR>(leds, LED_NUMBER);
} else if (la == "BRG") {
FastLED.addLeds<TM1804, DATA_PIN, BRG>(leds, LED_NUMBER);
} else if (la == "BGR") {
FastLED.addLeds<TM1804, DATA_PIN, BGR>(leds, LED_NUMBER);
}
FastLED.setMaxPowerInVoltsAndMilliamps(12, LED_LIMIT_MILLIAMPS);
}
i get this error message:
section .text' will not fit in region
iram1_0_seg’
I tried this with a brand new sketch and also got the same error so it is not that my sketch is to big (my geuss).
Can someone explain me what is wrong here? maybe give a workaround or solution to this?
I already tried looking on google for like a whole day but i cant get it to work right
O ps. I am a noob and this is my first coding/project.
Thanks.