Sunrise effect lighting problem - trying to refresh palette cycle on timed LEDs.

Hello, I am new to this site so I apologize for not any missed guidlines.
Anyhow here is my issue.

I have a strip of 20 LEDs on my arduino uno. The code lights up the middle two LEDs first with a heatColor palette and moves outward from the center to the ends of the stip timed with millis.

The timing of turning on the LEDs works fine, however as every next set of LEDs come the colors start at whatever point the initial middle two LEDs are at in the palette cycle. I want each set to start from the beginning of the defined palette color as they come online.

This is to create a sunrise effect that grows across the strip. New to coding I appreciate any help I can get to remedy this.

#include <FastLED.h>
#define NUM_LEDS 20
#define DATA_PIN 3

CRGB leds[NUM_LEDS];

boolean lighting = true;

unsigned long event = 1000;
unsigned long event2 = 1500;
unsigned long event3 = 1600;
unsigned long event4 = 1700;
unsigned long event5 = 1800;
unsigned long event6 = 1900;
unsigned long event7 = 2000;
unsigned long event8 = 2100;
unsigned long event9 = 2200;

void setup(){

delay(500);
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
}

void loop()

{
static uint8_t startIndex = 0;
startIndex = startIndex + 1; /* motion speed */
FillLEDsFromPaletteColors(startIndex);
}

void FillLEDsFromPaletteColors(uint8_t heatIndex)

{
if(lighting == true){
while(heatIndex < 240){

CRGB color = ColorFromPalette(HeatColors_p, heatIndex);

leds[9] = CRGB(color);
leds[10] = CRGB(color);

if(millis() >= event)leds[8] = CRGB(color);
if(millis() >= event)leds[11] = CRGB(color);

if(millis() >= event2)leds[7] = CRGB(color);
if(millis() >= event2)leds[12] = CRGB(color);

if(millis() >= event3)leds[6] = CRGB(color);
if(millis() >= event3)leds[13] = CRGB(color);

if(millis() >= event4)leds[5] = CRGB(color);
if(millis() >= event4)leds[14] = CRGB(color);

if(millis() >= event5)leds[4] = CRGB(color);
if(millis() >= event5)leds[15] = CRGB(color);

if(millis() >= event6)leds[3] = CRGB(color);
if(millis() >= event6)leds[16] = CRGB(color);

if(millis() >= event7)leds[2] = CRGB(color);
if(millis() >= event7)leds[17] = CRGB(color);

if(millis() >= event8)leds[1] = CRGB(color);
if(millis() >= event8)leds[18] = CRGB(color);

if(millis() >= event9)leds[0] = CRGB(color);
if(millis() >= event9)leds[19] = CRGB(color);

heatIndex += 1;
FastLED.show();
FastLED.delay(100); }

Boolean_Sunrise_9_LEDs.ino (2.07 KB)

You should post your code in code tags according to the guidelines Read this before posting a programming question ...

One major issues I see with your code is your testing of the event times:

    if(millis() >= event)leds[8] = CRGB(color);

millis() is the number of milliseconds since the board was reset. As soon as millis() exceeds any of your event times then it will exceed that time until you reset the board or the timer rolls over (after many days).

can you provide the documentation of the FastLED.h-library.

I have never used this FastLED.h-library. So for help I would have to read this documentation.
(Which of course you can do too)

best regards Stefan

Thank you very much for help with this.

Most of this is very foreign to me but I hope I grabbed the right documentation you requested below.

I have the whole FastLED folder zipped if that’s more of what you need.
Please just let me know.

keywords.txt (8.26 KB)

you have just uploaded the keywords-file.
This is not of much help. The real important files are

FastLED.h and FastLED.cpp

best regards Stefan

Again thank you.
Your help is very much appreciated.
Here are the two files as listed.

FastLED.cpp (6.35 KB)

FastLED.h (31.1 KB)

ToddL1962:
You should post your code in code tags according to the guidelines Read this before posting a programming question ...

One major issues I see with your code is your testing of the event times:

    if(millis() >= event)leds[8] = CRGB(color);

millis() is the number of milliseconds since the board was reset. As soon as millis() exceeds any of your event times then it will exceed that time until you reset the board or the timer rolls over (after many days).

Did you fix this yet? This will eventually cause all leds to be set to CRGB(color) no matter what you do.

Not fixed yet.

I d want them to all be from the same color palette though. Just each set starting fresh on the color palette and not at the same point as the initial middle two.

deadpixelz:
Not fixed yet.

I d want them to all be from the same color palette though. Just each set starting fresh on the color palette and not at the same point as the initial middle two.

No problem. Just making sure you knew it would result in all LEDs displaying at the same time.