I've got a simple script here where I cycle 1 to many white lights throughout a strand of red lights... Think of this as a clock hand spinning around the face, the hand being different widths. When the widths (size) is set from 1 to 4, there's no problem. Set the size to 5 or more and FastLED seems to hang. By the way, the script in the loop works properly using the Adafruit_WS2801 library, but FastLED offers much, much more - brightness control initially. Thanks for any help provided.
#include "FastLED.h"
#define NUM_LEDS 20
#define DATA_PIN 2
#define CLOCK_PIN 3
CRGB leds[NUM_LEDS];
void setup() {
delay(2000);
FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
FastLED.setBrightness(5);
}
void loop() {
int size = 4; // Setting size from 1 to 4 works
// int size = 5; // Setting size to 5 or more does not work
bool firstRun = true;
int i, j;
uint8_t wait = 100;
while (0 == 0) {
for (i=0; i < NUM_LEDS; i++) {
leds[i] = CRGB::White;
FastLED.show();
if (i == 0 && size == 1 && firstRun == false) leds[NUM_LEDS - 1] = CRGB::Red;
else if (i > 0 && size == 1) leds[i - 1] = CRGB::Red;
else if (i == 0 && size > 1 && firstRun == false) leds[NUM_LEDS - size] = CRGB::Red;
else if (i > 0 && size > 1) {
if (i < size && firstRun == false) leds[NUM_LEDS - size + i] = CRGB::Red;
leds[i - size] = CRGB::Red;
}
FastLED.show();
delay(wait);
}
firstRun = false;
}
}