I'm just now getting into programming LEDs and I'm diving head first in and

I’m just now getting into programming LEDs and I’m diving head first in and trying to learn as much as I can. The amount of information on this G+ site is great, and I intend to eventually read just about every single post! :wink:

I was recently reading a post from @Mark_Kriegsman about anti-aliasing. It’s a very helpful example (and I even found the ASCII art useful :wink: ).

In looking at the code though, one thing isn’t clear to me. In setting the brightness for first and last pixels in the light bar, he did this:

leds[i] += CHSV( hue, 255, bright);

I’m still learning C/C++ (although I have quite a decent amount of experience in C#), so this may be a dumb question, but what does the += do in this particular instance? Based on what I know, I would expect it to add to the existing HSV values for the specified LED, but in looking at the intent, along with what the video shows, it appears to be replacing the existing values.

Is there a reason you wouldn’t just use = instead? Like this:

leds[i] = CHSV( hue, 255, bright);

"The library supports a rich set of ‘color math’ operations that you can perform on one or more colors. For example, if you wanted to add a little bit of red to an existing LED color, you could do this:

// Here’s all that’s needed to add “a little red” to an existing LED color:
leds[i] += CRGB( 20, 0, 0);
That’s it."

Taken from the github page: https://github.com/FastLED/FastLED/wiki/Pixel-reference#color-math

I had the same confusion. I think that = is actually what’s happening here since it’s being zero’d out above. Mark can you confirm?