hello, Im here trying to learn to write some code. As you can tell I am a rookie at this, im stuck on this little task, because i dont know or understand the terminology so please bear with me in my code. I have a strip of 40 addressable leds going back and forth like the knightrider pattern i have learned alittle to get to that point but now i would like to add in a solid fill to the mix in which once the last led returns from the 40th led back down to led0 that the entire led strip would be lit on a solid color till i cut power off. i dont know how to even begin to write that part of the code. thanks for any help or advise you give. Here is my code so far:
#include <FastLED.h>
#define NUM_LEDS 40
#define LED_PIN 4
CRGB leds[NUM_LEDS];
void setup() {
// put your setup code here, to run once:
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(20); //0-255 brightness
}
void loop() {
// put your main code here, to run repeatedly:
for(int i = 0; i <NUM_LEDS; i++){
leds[i] = CRGB::GhostWhite;
FastLED.show();
delay(75);
leds[i] =CRGB::Black;
}
for(int i = NUM_LEDS-1; i >=0; i--){
leds[i] = CRGB::GhostWhite;
FastLED.show();
delay(65);
leds[i] = CRGB::Black;
}
}