None of my FastLED+Teensy sketches will compile.
I recently got a new laptop and migrated my sketches over from my old computer. I downloaded FastLED from Github and installed it, but have been unable to compile any of my sketches that use FastLED and Teensy. I’ve tried reinstalling the FastLED library in both C:\Users\Kevin\Documents\Arduino\libraries and in C:\Program Files (x86)\Arduino\libraries but neither was successful. The error messages I get when compiling are all variations of (using DemoReel100 as an example here):
DemoReel100:42: error: ‘rainbow’ was not declared in this scope
SimplePatternList gPatterns = { rainbow, rainbowWithGlitter, confetti, sinelon, juggle, bpm };
So despite the fact that DemoReel100 does not make use of any Teensy functions, it will not compile if the chosen board is a Teensy. Choosing a different board WILL compile.
OS: Windows 10 Home 64 bit
Arduino IDE: 1.6.7 (most recent stable release) + Teensyduino
Board: Teensy 3.1
FastLED: 3.001.000
Can you turn on verbose build output in arduino and put up a full build log with all the error messages into a pastebin or gist so I can see everything.
However, most likely you are hitting the Arduino bug described here - preprocessor fails on #include "ESP8266wifi.h" (for external ESP8266 addon) · Issue #68 · arduino/arduino-builder · GitHub - which should be fixed in 1.6.8.
What’s happening is Arduino does this thing where it “automatically” creates function prototypes (in C/C++ - you’re supposed to declare functions before you use them) for you behind the scenes. This is one of those places where, in an attempt to make things “easier” for users, Arduino actually breaks what should be a standard practice - and when their tools fall over, people aren’t left with any indication for what they should do.
Add the following lines to the top of the ino file (but after #include FastLED.h):
void nextPattern();
void rainbow();
Thanks for the quick response Daniel.
Here’s the log http://pastebin.com/UM6eH0tt
I added the void nextPattern(); and void rainbow(); to the top of the .ino file as you suggested but unfortunately it still did not compile. However, I did notice in the error log that I no longer recieved an error with void nextPattern(); and void rainbow(); http://pastebin.com/ziXhmYfr
You need to do something similar with all the other functions that it is complaining about missing.
Added the rest of the functions it was complaining about and now it’s upset with passing variables to functions. http://pastebin.com/Es7X1jhy
I think I’ll just stick to my old laptop until 1.6.8 is released, since it sounds like this is a problem with Arduino and not FastLED.
What did you put for the addGlitter function? Part of the reason for declaring functions before using them in C/C++ is so the compiler knows what types to use for parameters.
For addGlitter what you want is:
void addGlitter( fract8 chanceOfGlitter);
not
void addGlitter();
I had tried void addGlitter(); and void addGlitter( 80 );
It now compiles with void addGlitter( fract8 chanceOfGlitter);
Thank you!
@Kevin_Wagner With 1.6.7 almost every sketch has to be modified in the above mentioned way. If you download 1.6.4 your problems are gone
https://www.arduino.cc/en/Main/OldSoftwareReleases#previous
I had the same problem with ide1.6.7 and teensy 3.1. So i downgrade to 1.6.5. If you use MS visual studio + visual micro and declare 1.6.7 as your ide, everything goes right. I don’t know why, but i confirm that is not a fastled problem.
For me it is the same. Arduino 1.6.7 and FastLed 3.1 don’t work. I had to go back to the IDE 1.6.5!
I also went back to 1.6.5 and have had no problems with FastLED or Teensyduino.
Unfortunately also the new Arduino Hourly Builds (1.6.8?) don’t work with FastLed; I just tested now!
@Antonio_Valenti can you be more specific about how it isn’t working? I just downloaded the latest hourly build for the mac off of https://www.arduino.cc/en/Main/Software (window title bars say “Arduino 1.6.8 Hourly Build 2016/02/09 06:13)” ) – what specifically did you download, and what errors are you getting?
@Daniel_Garcia OK! For example you can see in “DIscoStrobeWithPalette” at “https://gist.github.com/kriegsman/626dca2f9d2189bd82ca” with Mac OS X El Capitan, FastLed 3.1 and “Arduino 1.6.8 Hourly Build 2016/02/09 06:13”. The report (synthesized) is:
‘discoWorker’ was not declared in this scope discoWorker( dashperiod, dashwidth, dashmotionspeed, strobesPerPosition, hueShift);…In function ‘void discoWorker(uint8_t, uint8_t, int8_t, uint8_t, uint8_t)’… error: ‘drawRainbowDashes’ was not declared in this scope kSaturation, kValue);…exit status 1
‘discoWorker’ was not declared in this scope.
…sorry I forgot … with IDE 1.6.5. everything works perfectly.
Ah - what’s causing the problem that you’re seeing, @Antonio_Valenti , is this issue - IDE 1.6.6 breaks sketches that use multiline function declarations. · Issue #80 · arduino/arduino-builder · GitHub - which has to do with function prototypes that have their arguments on multiple lines
See this simple example (which has no FastLED code in it) that is broken:
vs. this simple example, which is the same code, just with a couple of newlines removed which compiles:
(Also - note that issue #80 is still marked open, unlike issue #68 which is marked as closed).
Since i’ve been wanting an excuse to play with go anyway, I just submitted a pull request to the arduino builder folks with a possible fix for this second issue.