Hii, I have mentioned my code for the pattern which i am trying to

Hii, I have mentioned my code for the pattern which i am trying to implement using FOR Loop and delay() which i have pasted below at the end.
What it does is, it increment from 1 to 50(i.e.NUM_LEDS) with a fixed color (lets say red) with out fading the previous LED to black. Firstly the program is becoming a bit longer and secondly to change the direction from 50 to 1 i have to write the same program again where instead of using ++ i use --. I wanted to know if there is any predefined function in FastLED that does the same thing if not how can i make it a bit simpler i.e without using delay().
Thank you for your time
below is the function that i tried

void series_asc()
{
for(i=0;i<NUM_LEDS;i++)
{
leds[i] = CRGB::Red;
FastLED.show();
delay(50);
}
}
one more thing is there any way i can change the color after every cycle(i.e from red to green to blue then yellow and so on)

What you want to use instead of delay() is EVERY_N_MILLISECONDS() or EVERY_N_SECONDS().

Here’s an version for you which might give you some ideas. (Also, put FastLED.show() back in your main loop when using the below example.)

void series_asc() {
static int16_t pos = 0; // position along strip
static int8_t delta = 3; // can be negative, and/or odd numbers
static uint8_t hue = 0; // hue to display
EVERY_N_MILLISECONDS(50) {
leds[pos] = CHSV(hue,255,255);
pos = (pos + delta + NUM_LEDS) % NUM_LEDS;
if (delta >= 0 && pos == 0) { //going forward
hue = hue + random8(42,128);
}
if (delta < 0 && pos == NUM_LEDS-1) { //going backward
hue = hue + random8(42,128);
}
}//end_EVERY_N
}//end_series_asc

This piece of code is awesome and it works just fine when i call it in void loop() .
when i call this function in ColorPalette program it gets skipped/ignored,i even tried to place it at different timing location.
any idea why is it happening so.

Please post your code to http://gist.github.com.

This is the link

Lines 60 through 71 are calling palette changes, not a function to run. Adding series_asc there doesn’t work because it is only called a single time when secondHand == 20, but series_asc needs to be called over and over again through the main loop in order to continue to run, just like the function FillLEDsFromPaletteColors is being called on line 36 every single time around through the main loop.

If you want to run both FillLEDsFromPaletteColors and series_asc fuctions (toggle between them) you will need to create way to switch between them. You could switch based on a random time, with a EVERY_N timer, a case switch, or an IF statement. Depending on what method you choose you might need to create a variable that gets changed to determine what function to call. You could have these get changes inside the { } along with the palette changes in lines 60 through 71.

One way would be something like:
if( secondHand == 20) { runFunctionA = true; }

then update the next if( secondHand… line to switch it back off:
if( secondHand == 0) { runFunctionA = false; currentPalette = RainbowColors_p; currentBlending = LINEARBLEND; }

okay thanks i will try this

@marmil I want to know if there is any palette that is all ready defined for this effect or can it be created.
Because I tried the other approach that u stated above and i could not figure out the correct time to switch between the two functions.
can u help me with some other approach to fix this problem.

I doubt there is anything already defined for exactly what you want to do.

And No one can help if you don’t post your code. Please post your code to http://gist.github.com.

Below is the link to program i have written or gathered.
I have patterns in my mind i don’t know how to implement them,I have no idea how to use the color utility function to implement new patterns or how they work.
This is what i can tell u about what’s going on with me

The program has one more problem, If i run this program for long time direction changes in between that is
EVERY_N_SECONDS(147)
{ // change direction every few seconds
dir = dir * -1;
}
does not seem to switch at precis time . direction changes before ChangePalettePeriodically() completes.
any idea y this is happening

Have you tried out the DemoReel100 example? That example is setup for switching between patterns. The ColorPalette example was made to demo switching palettes. It could be used to switch patterns, but not as written. You will need to trigger a pattern change or set a flag or variable of some sort to specify which pattern to run next. Most patterns need to be called over and over to create the pattern animation, so calling a function one time won’t work (unless it’s something very simple like fill_solid). The series_asc function from the other day won’t work if it’s called just one time. Read my previous previous post again.

EVERY_N_SECONDS(147) and ChangePalettePeriodically() are two different timers running independently so they will not happen at the same time.
And if you’re timing the 147 seconds on your stopwatch and not seeing it happen exactly when you expect it to at 147 seconds that’s because multiple things might be throwing the timing off a bit over time. If rather precise timing is required then a RTC can be used such as: https://www.adafruit.com/product/3013

Okay i will look at it, and let u know

Hii,i have written a code(function) for a pattern that i have mentioned below in that i want to change the color after each cycle that is from Red-Yellow-Orange-Green-so on and so forth.I was thinking of using EVERY N SECOND() to increment the HUE but i don’t weather to call it in void loop or to call in function its self .Any idea?

#include <FastLED.h>
#define LED_PIN 3
#define NUM_LEDS 50
#define BRIGHTNESS 110
#define LED_TYPE WS2811
#define COLOR_ORDER RGB
CRGB leds[NUM_LEDS];
#define UPDATES_PER_SECOND 100
uint8_t gHue = 0;
int i,j;

void setup() {
delay( 3000 ); // power-up safety delay
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.setBrightness( BRIGHTNESS );
}

void loop()
{
converger_reduce_size();
//diverge_reduce_size();
FastLED.show();
}

void converger_reduce_size()//converges and then reduces in size.
{
int Color1 = CRGB::Yellow;//I want to change the color after the each cycle completes
CRGB Black = CRGB::Black;
for(i=0,j=49 ; i<=25 ,j>=25; i++,j-- )
{leds[i] =leds[j] = Color1;FastLED.show();delay(50);}
for(i=0,j=49 ; i<=20 ,j>=29; i++,j-- )
{leds[i] =leds[j] = CRGB::Black;FastLED.show();delay(100);}
for(i=0,j=49 ; i<=20 ,j>=29; i++,j-- )
{leds[i] =leds[j] = Color1;FastLED.show();delay(100);}
for(i=0,j=49 ; i<=15 ,j>=34; i++,j-)
{leds[i] =leds[j] = CRGB::Black;FastLED.show();delay(100);}
for(i=0,j=49 ; i<=15 ,j>=34; i++,j-)
{leds[i] =leds[j] = Color1;FastLED.show();delay(100);}
for(i=0,j=49 ; i<=10 ,j>=39; i++,j-- )
{leds[i] =leds[j] = CRGB::Black;FastLED.show();delay(100);}
for(i=0,j=49 ; i<=10 ,j>=39; i++,j-- )
{leds[i] =leds[j] = Color1;FastLED.show();delay(100);}
for(i=0,j=49 ; i<=5 ,j>=44; i++,j-- )
{leds[i] =leds[j] = CRGB::Black;FastLED.show();delay(100);}
for(i=0,j=49 ; i<=5 ,j>=44; i++,j-- )
{leds[i] =leds[j] = Color1;FastLED.show();delay(100);}
for(i=0,j=49 ; i<=25 ,j>=25; i++,j-- )
{leds[i] =leds[j] = CRGB::Black;FastLED.show();}
}