HSV question.

Is there a command like leds*.setHue(224);* for saturation and brightness?

You can use

leds[i] = CHSV(hue, sat, val);

Note that in FastLED library, hue is 0..255 not 0..359.

PaulRB: You can use

leds[i] = CHSV(hue, sat, val);

Note that in FastLED library, hue is 0..255 not 0..359.

It just seemed odd that there would be a set.hue() function but no set.saturation() or set.v() functions.

From this page:

For example, to set an led to a color specified in HSV, you can simply assign a CHSV color to a CRGB color:

  // Set color from Hue, Saturation, and Value.  

// Conversion to RGB is automatic.
  leds[i] = CHSV( 160, 255, 255);

// alternate syntax
  leds[i].setHSV( 160, 255, 255);

// set color to a pure, bright, fully saturated, hue
  leds[i].setHue( 160);



There is no conversion back from CRGB to CHSV provided with the library at this point.

So setHue(h) is equivalent to setHSV(h, 255, 255).

In other words, whichever of the above functions you use, you are providing all 3 of h, s & v. These values are immediately converted to r, g & b and stored that way.

If a function existed like setSaturation(s) which was equivalent to setHSV(?, s, 255) it would be useless because saturation is meaningless without a specified hue. Same for Value, unless you assume saturation = 0 (ie. white) in which case hue is irrelevant.

Perhaps your next question will be “why can’t I write…”

leds[i].setHue(h);
leds[i].setSaturation(s);
leds[i].setValue(v);

“and that would be equivalent to…”

leds[i].setHSV(h, s, v);

“?”

You can’t have that because as soon as you use setHue(h), the result is converted to r, g & b. To be able to use setSaturation(s) afterwards, the function would need to know what h was. That h value could in theory be calculated from the stored r, g & b values. But as the page says, there are currently no functions in the library to convert r, g, b back to h, s, v.