FASTLed Fade not completing

Hi,

I am trying out fade(tail) effect from the FastLED library demos. I would like the LEDs to come on full bright and then start the fade while the next one comes on and so on. This is working great except the effect does not complete. Once the For loop goes through a given number of LEDs, it stops while tail is still lit rather than faded to black. I would all of them the go dark.

Also, I would like to accomplish the revers where LEDs come on dim and start the get bright while traveling forward and the ones in the tail go to full brightness and remain lit.

Here is the code to turn LEDs off with a fading tail (it does complete the fade to black on all LEDs).

Thanks.

=============================================

#include<FastLED.h>
#define NUM_LEDS 50

CRGBArray<NUM_LEDS> leds;

boolean bSingle = true;

void setup() {
 FastLED.addLeds<NEOPIXEL, 3 >(leds, NUM_LEDS);
}

void loop() {
   if (bSingle){
   rbpm();
   delay(5000);
   }
}

void rbpm () {
 bSingle = true;
 static uint8_t hue;
 for (int i = NUM_LEDS ; i > 0; i--) {
   // fade everything out
   leds.fadeToBlackBy(50);

   // let's set an led value
   leds[i] = CHSV(hue++, 255, 255);


   FastLED.delay(25);
 }
}

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :)

i > 0

means it never hits 0. And 0 is the first LED of the string.

try i >=0

Hi,

Thank you for your reply. >= did not make it work. essentially whole tail remains lit. I have uploaded a video to show the effect.

Thanks.

What's it supposed to do? Change colors each pass or rainbow across the strip in one go? What happens to the hue variable? It just increases and probably rolls over?

Try using normal delay(25) instead of FastLED.delay(25)

Where'd you get the code? I don't have it in my FastLED examples unless it's a newer update. Did you find it online or under examples in the IDE menu?

I think you have to use

FastLED.show(); delay(25);

to replace the FastLED.delay

INTP: What's it supposed to do? Change colors each pass or rainbow across the strip in one go? What happens to the hue variable? It just increases and probably rolls over?

Try using normal delay(25) instead of FastLED.delay(25)

Where'd you get the code? I don't have it in my FastLED examples unless it's a newer update. Did you find it online or under examples in the IDE menu?

Hi, It is supposed to light LEDs as it travels down the strip. While it is traveling, it creates a fading trail where x number of LEDs behind the leader fade to black. End result should be all faded to black including the leader LED. As you can see from the video, once the leader LED reaches the end, the whole process stops and tail stops fading.

I took this code out of a demo file called "DemoReel100". It is part of the FastLED library demos that are part of the Arduino IDE. When you first look at the Examples menu in the IDE, you do not see it because menu has a scroll. You have to scroll down within the menu to see additional samples.

FastLED.Delay() not only makes this delay but it also makes the LEDs come on.

INTP: I think you have to use

FastLED.show(); delay(25);

to replace the FastLED.delay

Hi INTP,

Splitting the delay as you suggested made no difference.

Thank you.