I have both an Arduino Due and Arduino Mega 2560, for this example.
For the below code. and in many instances of other sketched that use FastLED I am seeing the behavior.
When running the below code on the Mega or Uno it runs with no problems.
When using the same exact code on the Due it will run through the cycle once and then stops. in other sketches it will not even start (but will work 100% on the Mega) I did notice however sometime when I unplug it from the USB. the LEDs will suddenly change to a frame in the code that you where not able to see before. almost like it is running the code but not updating the pixels.
#include “FastLED.h”
#define NUM_LEDS 50
CRGBArray<NUM_LEDS> leds;
void setup() {
FastLED.addLeds<WS2811,53>(leds, NUM_LEDS);
}
void loop(){
int randNumber = 0 ;
static uint8_t hue;
for(int i = 0; i < NUM_LEDS; i++) {
// fade everything out
leds.fadeToBlackBy(10);
randNumber = random(0, 255);
// let’s set an led value
//leds[i] = CHSV(randNumber,255,255);
if(i%2==0)
leds[i] = CRGB(255,0,0);
else
leds[i] = CRGB(0,255,0);
leds[i+1] = CRGB(255,0,0);
leds[i+2] = CRGB(255,0,0);
leds[i+3] = CRGB(255,0,0);
leds[i+4] = CRGB(0,0,0);
leds[i+5] = CRGB(0,0,0);
leds[i+6] = CRGB(255, 140, 80);
leds[i+7] = CRGB(255, 140, 80);
leds[i+8] = CRGB(255, 140, 80);
leds[i+9] = CRGB(255, 140, 80);
leds[i+10] = CRGB(255, 140, 80);
leds(NUM_LEDS,NUM_LEDS+1);
//FastLED.show();
FastLED.delay(100);
}
}
Any help on understanding this would be great. Thanks!