Does FastLED work with a digispark? The examples aren't compiling,

fastled-support
gplus
(Michal Hipner) #1

Does FastLED work with a digispark? The examples aren’t compiling, im kinda new to arduino, could someone help me?

(Hunter King) #2

What error are you getting? I’m using a digispark clone. The only issues I had were related to the timer0_millis variable. I was able to get around that with the following definition right after the FastLED.h include:

volatile unsigned long timer0_millis = 0;

I have heard people complain that there were having problems with FastLED 3.1 and 3.2. I’m personally using linux with FastLED 3.0, arduino 1.0.4, and the latest micronucleus library (the one built into digisparks arduino bundle didn’t play nicely with x64 kernels).

(Michal Hipner) #3

I have both a real Digispark and a clone at my disposal. Im using arduino 1.0.4 software (from digspark) Loaged the FastLED 3 (i have version 3. something) fire2012 example and when i press verify i get this in the black box (console/output?)
Fire2012.cpp.o: In function L_1794': C:\Program Files (x86)\DigisparkArduino-Win32-1.0.4-May19\DigisparkArduino-Win32\Digispark-Arduino-1.0.4\libraries\FastLED3/clockless_trinket.h:110: undefined reference totimer0_millis’
C:\Program Files (x86)\DigisparkArduino-Win32-1.0.4-May19\DigisparkArduino-Win32\Digispark-Arduino-1.0.4\libraries\FastLED3/clockless_trinket.h:110: undefined reference to timer0_millis' C:\Program Files (x86)\DigisparkArduino-Win32-1.0.4-May19\DigisparkArduino-Win32\Digispark-Arduino-1.0.4\libraries\FastLED3/clockless_trinket.h:110: undefined reference totimer0_millis’
C:\Program Files (x86)\DigisparkArduino-Win32-1.0.4-May19\DigisparkArduino-Win32\Digispark-Arduino-1.0.4\libraries\FastLED3/clockless_trinket.h:110: undefined reference to timer0_millis' C:\Program Files (x86)\DigisparkArduino-Win32-1.0.4-May19\DigisparkArduino-Win32\Digispark-Arduino-1.0.4\libraries\FastLED3/clockless_trinket.h:112: undefined reference totimer0_millis’
Fire2012.cpp.o:C:\Program Files (x86)\DigisparkArduino-Win32-1.0.4-May19\DigisparkArduino-Win32\Digispark-Arduino-1.0.4\libraries\FastLED3/clockless_trinket.h:112: more undefined references to `timer0_millis’ follow

(Hunter King) #4

yea, just define the timer0_millis variable. Here are the first couple lines of a sketch I just compiled without a problem:

#include<FastLED.h>

volatile unsigned long timer0_millis = 0;

#define NUM_LEDS 16

// The leds
CRGB leds[NUM_LEDS];

(Michal Hipner) #5

so i basically have to always add this line to make it work on a digi spark?: volatile unsigned long timer0_millis = 0; Also is fastTLED smaller than the neopixel library?

(Mark Kriegsman) #6

As for “which is smaller”, I tried to answer that question in a new post: https://plus.google.com/112916219338292742137/posts/6AUgfAKWVs5

(Daniel Garcia) #7

At least until I officially add digispark support, yes you will have to add those lines.

(Michal Hipner) #8

ok, np. I have another question.
Do the boards have a limit to how many LEDs they can control? (like a processing power limit or something?)
I was using a digispark clone with fastLED and the colorPalette example ran fine up to 90 LEDs, as soon as i tried 120 LED it would not work.

(Daniel Garcia) #9

They are more limited in memory than anything (though, not having hardware multiply does limit their processing power as well, relative to, well, just about anything else). You only have 512 bytes of ram - each led is going to take up 3 bytes of ram, so at 120 leds you’re using 360 bytes of ram, leaving only 152 bytes for everything else that’s needed (including the call stack, which can take up anywhere from a few bytes to a few dozen bytes per call currently on the stack, as well as other system pieces). My experience with the ATTiny based systems is you’re looking at, realistically 70-95 leds. I have some ideas for squeezing even more out, but I think 120 might be pushing it.

(Mark Kriegsman) #10

You ran out of RAM.

The ATtiny85 only has 512 bytes of RAM total. All your variables, all the globals, and the call stack, and the Arduino system variables (eg millisecond counters) have to fit in there.

AND every LED takes up 3 bytes of RAM. 120 LEDs need 360 bytes just for the LED buffer. 90 LEDs only need 270 bytes. Somewhere between 270 bytes and 360 bytes, it ran out of RAM.

The ATmega328 has 2,048 bytes of RAM. The ATmega32U4 has 2,560 bytes. All of the ARM-based boards have LOTS more.

(Mark Kriegsman) #11

My shorthand way of remembering this is that the maximum number of LEDs you should try to run off an ATtiny85 is “85”, and the maximum number you should try to run from an ATmega328 is “328”.

Doesn’t work for other processors, but it’s a quick mnemonic.

(Michal Hipner) #12

Thank you explaining this to me. What is the cheapest controller i need to run 200-220 LEDs? (Clones included) So i would need something with at least 1024 bytes of RAM? because the LEDs alone need 660 bytes and then some more for the other stuff? Would a Arduino Nano work?

(Mark Kriegsman) #13

Nano will work (2K RAM). I’ve been liking the DFRobot Beetle http://www.dfrobot.com/index.php?route=product/product&product_id=1075 which is about $8 and has 2.5K RAM.

(Michal Hipner) #14

Thanks Mark. I’ll try using a nano clone if i can find one bc they’re $4 but i’ll keep the beetle in mind if i need something smaller. Do you ever use hangouts?

(Mark Kriegsman) #15

Hangouts? No, not really.

(Michal Hipner) #16

ok, thanks for the help. I really appreciate it.