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();}
}