I have a strip of 146 LEDs. WS2815. I want to light 75 of them in sequence and then get the remaining 72 to light using "glitter" from fastLED for 3 seconds and then write to those 72 to become solid colors. I can get the whole strip to glitter but I can't get just the LEDs from #74 to #145 to glitter. It seems that I'm having a problem defining my starting point in the array. I don't want to start at 0 but rather at 75 any help would be more than welcome. Just a note to please be gentle with me as I am 76 years old and this is for a project for Burning Man. Not that that really makes any difference. Thanks.
#include "FastLED.h"
#define LEDPIN 7
#define LED_TYPE WS2815
#define NUM_LEDS 146
#define BRIGHTNESS 60
#define FRAMES_PER_SECOND 120
CRGB leds[NUM_LEDS];
void setup() {
//sanity delay
delay(1000);
// set up LED strip info
FastLED.addLeds<LED_TYPE,LEDPIN>(leds,NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(BRIGHTNESS);
}
void loop() {
fadeToBlackBy( leds, NUM_LEDS, 20);
/* It takes 3 parameters:
1 the array you are dimming,
2 the number of LEDs in that array you are dimming starting from index [0] (the first LED in the array),
3 and the amount you would like to fade them. Changing the third variable changes how quickly the lights fadeSo an example would be:
This would reduce the colour values for all the LEDs to 20/256ths of their current value
in a previous line we set the whole array of LEDs to CRGB:: white, which means that the r, g, and b values are all 255.
Then we would write the line:
*/
fadeToBlackBy(arrayName, lengthOfStrip, 10);
//changing this variable will increase the chance of a "star" popping up
addGlitter(200);
FastLED.show();
}
//glitter effect
void addGlitter( fract8 chanceOfGlitter) {
if( random8() < chanceOfGlitter) {
leds[ random16(NUM_LEDS) ] += CRGB::White;}
}