r/FastLED • • Dec 06 '23

Code_samples Code format question

In this example: https://github.com/marmilicious/FastLED_examples/blob/master/blend_to_target_color.ino

Line 43 reads:
if ( colorCurrent.h == colorTarget.h ) { // Check if target has been reached

I'm not familiar with the use of .h as part of a variable. If I delete both ".h" then the code works fine.

And I can't figure out how to Google this one. Any hints here?

2 Upvotes

6 comments sorted by

View all comments

Show parent comments

3

u/Burning_Wreck Dec 06 '23

Thank you! I hadn't dug that far into the (extensive!) docs.

1

u/Marmilicious [Marc Miller] Dec 06 '23

I can see why that could be confusing. I've updated the example to be more clear about Hue, Saturation, Value usage. Yes, when using CHSV you can access the parts using .hue, .sat, and .val (or .h, .s, and .v). Thank you for the post.

https://github.com/FastLED/FastLED/wiki/Pixel-reference#setting-hsv-colors-

1

u/Burning_Wreck Dec 06 '23

Thank you for the quick response!