I’m hoping to light up a strip one LED at a time starting from 0 to 59, using the colors generated by fill-gradient. The whole strip lights up at once, instead of one led at a time and I’m not sure what I’m doing wrong. Any help would be appreciated!
I’m using an Uno, Ver1.6.5 , FastLED3.1, mac, neopixel 60 strip.
Ken, thanks for the feedback, this is a great step and turns the pixels on one by one, and moves the gradient as “i” increases, but I would like the gradient to stay in place and just the leds to light one by one.
e.g. led 0 is always hue 0, led 30 is approx hue 80, led 59 is always hue 160.
maybe i’m taking the wrong approach and need to map the values of the pixel number against the hue values?
Neil, here’s an idea: in addition to creating CRGB leds[NUM_LEDS] at the top of the program make a second one for holding temporary values, such as CRGB ledsTemp[NUM_LEDS]. Fill the gradient into this temp array, and then you can copy one pixel at a time to the normal leds array and display.
leds[i] = ledsTemp[i];
Marc, it works!! Thank you so much for this advice!! This is fantastic.
I was working on mapping the values of i and hue against each other, but because I was wanting to go around the colour wheel in a negative direction it was proving problematic.
Here’s the code for others wanting to do something similar
void setup() {
FastLED.addLeds<NEOPIXEL,DATA_PIN>(leds, NUM_LEDS);
delay(3000); //startupdelay
fill_gradient (ledsTemp, 0, gradStartColor, 59, gradEndColor, SHORTEST_HUES); ////Fill the gradient into this temp array
}
void loop() {
for( int i = 0; i < NUM_LEDS; i++){
leds[i] = ledsTemp[i]; //copy one pixel at a time to the normal leds array and display
delay(50);
FastLED.show(); //FastLED.clear();
}