0

I'm currently working off an Arduino Uno. I was having issues with running out of RAM, and I managed to fix them. Then the person who this project is for let me know that there is another strip of 150 LEDs which are all one color.

This wouldn't be an issue, but the only way to set leds colors in FastLED that I know of is to give an array of colors where each index represents an LED.

In this scenario that's 450bytes of data, which is roughly 25% of an Arduino Unos ram, entirely dedicated to 3 bytes worth of data: one single color.

Now, besides this being an abhorrent waste of resources, it's also something I simply can not afford.

Does anybody know how I can set 150 LEDS to the same color without making an array?

What I've tried so far: I've tried going through the source code of FastLED, and have found that CFastLED::addLeds creates a CLEDController which later has CLEDController::show() called, which then calls 'showPixels()' which is a virtual function that is deabstracted by each different type of strip protocol class, and always requires an LED[] array. As far as I can tell, I would have to dive into each different protocol class before I could do this, at which point I might as well delete FastLED and write my own version from scratch.

In my scenario, the bottom of the chain seems to be this: https://github.com/FastLED/FastLED/blob/03d12093a92ee2b64fabb03412aa0c3e4f6384dd/platforms/arm/k20/octows2811_controller.h#L40

It seems there's really no decent way to set an entire strip of LEDs to the same color in FastLED.

Joel Spolsky
  • 33,372
  • 17
  • 89
  • 105
Seph Reed
  • 8,797
  • 11
  • 60
  • 125
  • Have you tried multiplexing how you control the LEDs? So you could avoid using FastLED class. – campescassiano Dec 29 '17 at 04:30
  • The two different strips will be on different pins. They are different types. I'm using FastLED to deal with the protocol. – Seph Reed Dec 29 '17 at 04:33
  • I'd just find everywhere that the `LED[]` array is used and short circuit it to use `LED[0]`. – user3386109 Dec 29 '17 at 05:00
  • That would break the functionality for the other strip that does use the addressing. I'm trying to find a way to create a second path that does that though. – Seph Reed Dec 29 '17 at 05:12
  • I got a strip of WS2812Bs not too long ago and I wasn't able to ever get something like this working. As far as I'm aware, you'll need to fork the library and manually hack it a bit yourself. – Cassandra Fox Dec 29 '17 at 05:41
  • I think you're right. For now, my easiest way forward is to just redo the project with a teensie. – Seph Reed Dec 29 '17 at 21:27
  • Don't use an individually addressable LED strip. if you just need them all the same color? – gre_gor Jan 03 '18 at 16:37
  • It's the material that I have. – Seph Reed Jan 04 '18 at 18:36

2 Answers2

1

If you just want to include the entire array, then it’s wiser to use the Adafruit NeoPixel library.

#include "Adafruit_NeoPixel.h"
#define LED_COUNT 14
#define LED_PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup()
{
strip.begin();
}
void loop()
{
for (int i = 0; i < LED_COUNT; i++)
{
strip.setPixelColor(i, strip.Color(255, 147, 41));
}
strip.show();
}
Carlos Cavero
  • 3,011
  • 5
  • 21
  • 41
Vasily
  • 11
  • 1
1
#include "Adafruit_NeoPixel.h"
#define LED_COUNT 14
#define LED_PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup(){
    strip.begin();
}
void loop(){
    strip.fill(strip.Color(255, 147, 41));
    strip.show();
}
Torokh
  • 33
  • 1
  • 8
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 09 '22 at 02:09