Hi,
I am trying to upload the following code to an attiny 84:
#include "FastLED.h"
// How many leds in your strip?
#define NUM_LEDS 50
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 3
#define CLOCK_PIN 2
// Define the array of leds
CRGB leds[NUM_LEDS];
int target[NUM_LEDS];
int showTime = 50;
int rchangetime = 300;
int gchangetime = 230;
int bchangetime = 715;
long rlastChange = 0;
long glastChange = 0;
long blastChange = 0;
long lastShowTime = 0;
int rDir = 1;
int gDir = -1;
int bDir = 1;
//boolean bDir = false;
int r,g,b;
void setup() {
// Uncomment/edit one of the following lines for your leds arrangement.
// FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<NEOPIXEL, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
//FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);
FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
//FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
Serial.begin(9600);
r=128/3;
g=10;
b=128-r-g;
if(b<0)b=0;
}
void loop() {
if (rchangetime+rlastChange<millis()){
r+=rDir;
if (r==0||r==128)rDir=-rDir;
rlastChange=millis();
}
if (gchangetime+glastChange<millis()){
g+=gDir;
if (g==0||g==128)gDir=-gDir;
glastChange=millis();
}
if (bchangetime+blastChange<millis()){
b+=bDir;
if (b==0||b==128)bDir=-bDir;
blastChange=millis();
}
if(lastShowTime+showTime<millis()){
int temp=r+b+g;
Serial.println(millis());
LEDS.showColor(CRGB(r, g, b));
Serial.print("r: ");
Serial.print(r);
Serial.print(" g: ");
Serial.print(g);
Serial.print(" b: ");
Serial.println(b);
lastShowTime=millis();
Serial.println(lastShowTime);
}
}
Code works with Arduino Uno but I get the following compile error when I try it for the attiny:
Blink_with_rgbstrip_tiny.cpp.o: In function `CLEDController* CFastLED::addLeds<(ESPIChipsets)1, (unsigned char)3, (unsigned char)2, (EOrder)10>(CRGB const*, int, int)':
D:\Arduino\libraries\FastLED/FastLED.h:63: undefined reference to `__cxa_guard_acquire'
D:\Arduino\libraries\FastLED/FastLED.h:63: undefined reference to `__cxa_guard_release'
I'm using Tinycore and Tinyisp.
I have tried searching the forum but there is not much on attiny and fastled.
Thanks
/H