FastLED Lite?   I have a ton of little costume bits and projects that

(Erin St. Blaine) #1

FastLED Lite?

I have a ton of little costume bits and projects that use gemma or trinket and while FastLED will load onto them, there’s not actually space to make it DO anything.

Is it possible to create a smaller FastLED library that just contains the basic functions (fill.gradient, fill.rainbow, etc) without all the fabulous bells and whistles, so I can use these little ATtiny chips? Has anyone done this?

I just don’t know what I can comment out and not break the whole shebang.

(Daniel Garcia) #2

The compiler is generally pretty good about cutting out things that aren’t being used, so you don’t need to explicitly do anything for that.

One thing that is possibly eating up a bunch of your space may be the palette tables if you reference them.

Can you post/shoot me your code, and I can do a build here and see the breakdown of what’s using space where/how?

(Mark Kriegsman) #3

I’ll second what Dan said: the compiler automatically only includes the code and data that you actually use, so commenting out code or data that you aren’t using anyway has no effect.

Are you running out of flash program storage space or RAM?

(Erin St. Blaine) #4

#include <FastLED.h>

#define LED_PIN 1
#define LED_PIN2 2
#define LED_PIN3 3
#define NUM_LEDS 12
#define BRIGHTNESS 50
#define SATURATION 255
#define HUE 0
#define SPEED 10

void setup() {
delay( 2000 ); // power-up safety delay

FastLED.addLeds<WS2812B, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.addLeds<WS2812B, LED_PIN2, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.addLeds<WS2812B, LED_PIN3, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );

//FastLED.setBrightness( BRIGHTNESS );


void loop()

void solid()


void add_glitter()
int chance_of_glitter = 5; // percent of the time that we add glitter
int number_of_glitters = 3; // number of glitter sparkles to add

int r = random8(100);
if( r < chance_of_glitter ) {
for( int j = 0; j < number_of_glitters; j++) {
int pos = random16( NUM_LEDS);
leds[pos] = CRGB::White; // very bright glitter

(Erin St. Blaine) #5

I’m not sure. It just says “Sketch too big” and tells me I’ve got 2004 bytes of a 5310 byte maximum.

(Daniel Garcia) #6

Ouch - I don’t even need to compile/disassmble this to suspect where the problem is - the issue here is the using 3 pins for leds - because of optimizations I do in the code and the way that it is arranged, that means that there’s three full copies of the WS2812 code in there, one for each pin. I’ve been wanting to re-organize that code so that instead of there being one copy for each pin there’s only one copy for each port (each port has up to 8 pins on it (32 on arm chips)) but haven’t gotten to it yet.

However, if all three strips are going to be showing the same content, for now you can connect all three strips to one data pin.

(Also, it doesn’t help that the code for writing WS2812s is unrolled, and it does a lot - so it’s pretty big to begin with - which is part of why I wanted to make that code specialize on the port, not the pin)

(Daniel Garcia) #7

(This is something that’s been on my radar to fix for a while, now)

(Erin St. Blaine) #8

Hmmm… I thought it might be something like that. Thanks!

(Bob Mulvey) #9

In the meantime; a teensy 3.1 will give you 256k of storage.

(Zeke Koch) #10

Yikes, I was going to post and say that I under the attiny’s all the time (so much simpler than the teensy for little stuff), but so far I’ve been using one pin…