At the very begining of my project (a circle of 286 WS2812B leds with an external DMX controls of general color, chaser color, speed and chaser lenght), this is my first sketch:
#include “FastLED.h”
// How many leds in your strip?
#define NUM_LEDS 286
#define DATA_PIN 6
#define BRIGHTNESS 64
CRGB leds[NUM_LEDS];
unsigned int atrain = 0; //startindex
unsigned int ltrain = 20; //lenght
unsigned int btrain = 20; //endindex
boolean Cchange = true; //newvalues for general colors or train colors
void setup() {
//Serial.begin(9600);
delay (3000);
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.setBrightness( BRIGHTNESS );
}
void loop()
{
if (Cchange == 1) {
gnrl ();
clrtrain();
}
Cchange = false;
chaser();
FastLED.show();
atrain = atrain + 1;
btrain = btrain + 1;
//FastLED.delay(10);
}
void gnrl()
{
fill_solid( &(leds[0]), NUM_LEDS, CRGB( 0, 0, 255) );//All color
}
void clrtrain()
{
fill_solid( &(leds[atrain]), ltrain, CRGB( 255, 200, 200) );//Train color
}
void chaser()
{
if (atrain <= 285)
{ leds[atrain].setRGB( 0, 0, 255);
}
else
{
atrain = 0 ;
leds[atrain].setRGB( 0, 0, 255);
}
if (btrain <= 285)
{ leds[btrain].setRGB( 255, 200, 200);
}
else
{
btrain = 0;
leds[btrain].setRGB( 255, 200, 200);
}
}
I use Fastled 3.1.3, Arduino Duemilanove, Arduino IDE 1.6.12 on OSX.
Why is this simple sketch so slow?
Do i have to use APA102 leds or is it a code problem?