Anyone using the ATTiny85 chip with FastLED? And I am talking about just the ATTiny85 chip itself not part of a Gemma or Trinket board. I am having some strange issues with code that I have used that works in one situation but fails in another.
Example:
#include <FastLED.h>
#define DATA_PIN 0 // change to Pin 0 for ATTiny
#define NUM_LEDS 65
CRGB strip[NUM_LEDS];
byte mode;
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(strip, NUM_LEDS); // setup the strip
mode = 0;
}
void loop() {
// Some example procedures showing how to display to the pixels:
switch (mode)
{
case 0:
colorWipe(0x7f0000, 50); // Red
colorWipe(0x7f7f00, 50); // Yellow
colorWipe(0x007f00, 50); // Green
colorWipe(0x007f7f, 50); // Cyan
colorWipe(0x00007f, 50); // Blue
colorWipe(0xff007f, 50); // Magenta
break;
case 1:
// Send a theater pixel chase in…
theaterChase(0x7f7f7f, 50); // White
theaterChase(0x7f0000, 50); // Red
theaterChase(0x007f00, 50); // Green
theaterChase(0x00007f, 50); // Blue
break;
case 2:
colorSnake(0x7f0000, 10, 50); // Red
colorSnake(0x7f7f00, 10, 50); // Yellow
colorSnake(0x007f00, 10, 50); // Green
colorSnake(0x007f7f, 10, 50); // Cyan
colorSnake(0x00007f, 10, 50); // Blue
colorSnake(0xff007f, 10, 50); // Magenta
break;
default:
mode = -1;
}
mode++;
}
void colorWipe(uint32_t c, uint8_t wait) {
for(int i=0; i<NUM_LEDS; i++) {
strip[i] = c;
FastLED.show();
delay(wait);
}
}
void colorSnake(uint32_t c, int length, uint8_t wait)
{
for(int i=0; i<NUM_LEDS+length; i++)
{
if (i < NUM_LEDS) {strip[i] = c;}
if (i-length >= 0) {strip[i-length] = 0;}
FastLED.show();
delay(wait);
}
}
//Theatre-style crawling lights.
void theaterChase(uint32_t c, uint8_t wait) {
int i, j, q;
for (j=0; j<10; j++) { //do 10 cycles of chasing
for (q=0; q < 3; q++) {
for (i=0; i < NUM_LEDS; i=i+3) {
strip[i+q] = c; //turn every third pixel on
}
FastLED.show();
delay(wait);
for (i=0; i < NUM_LEDS; i=i+3) {
strip[i+q] = 0; //turn every third pixel off
}
}
}
}
When I upload this to my ATTiny85, it runs. The first batch of the colorWipe run. Then the theaterChase sequence. But after the last of theaterChase instead of the colorSnake excuting, the theaterChase repeats endlessly! If I just put the sequences in the loop() without the case statement they work without fail. If I remove the theaterChase sequences (jues comment them out but leave in the case), the colorSnake sequence runs fine. Now this sequence executes fine using the original NeoPixel library without fail. Since I converted it to use FastLED I have had problems.
Any ideas? I really want to use FastLED instead of NeoPixel. so I really need some help here.
Thanks!

