Rather than just blindly copy and paste FastLED functions into sketches, I’m trying to break them down and understand them so that, hopefully, I can use what I learn to understand future functions (and, hopefully, bother you guys less).
I’ve been messing with fill-gradient and have figured out the following FastLED for Dummies explanation.
fill_gradient(leds,0,CHSV(0,255,255),100,CHSV(96,255,255),SHORTEST_HUES);
In the above example:
0 = the starting LED. LEDs are indexed to zero, so LED #1 is identified as 0, LED #2 is identified as 1, and so on.
CHSV(0,255,255) = the starting color of the gradient expressed in HSV values, in this case red.
100 = the ending LED. Like the starting LED, it can be any number.
CHSV(96,255,255) = the ending color for the gradient, in this case green.
SHORTEST_HUES = The hue is a value on a color wheel. There are always two directions you can go to get from one place on a wheel to another (one hue value to another hue value). FastLED lets you pick the direction you want to go. SHORTEST_HUES is the shortest distance between the two values (the most common choice), LONGEST_HUES is the longest way around. FORWARD_HUES always moves clockwise. BACKWARD_HUES always moves counter-clockwise.
My question is…
What does the ‘leds’ in the function (right after fill_gradient and before the zero) signify? Is it something that can be tweaked/altered/replaced – or does it just need to be there for some magical reason that only people far smarter than me understand?
I’ve also seen it in the fill-solids function, but sometimes it seems to be replaced by ‘struct CRGB * leds’ or ‘struct CHSV* targetArray’ or similar.
If it can be explained, I’d appreciate it. if it’s something you just have to keep hammering away at, I’m already on it! ![]()