READ SERIAL HSV VALUES, Hi everyone,

READ SERIAL HSV VALUES,

Hi everyone,

I’m working on a project where we need to read the serial values that come in HSV… if it where on rgb we would output them directly from the buffer to fastled.show … Can anyone help me to read the serial HSV values properly to output them directly to fastled.show()?

If you’re receiving HSV data you can use hsv2rgb_rainbow to convert it to RGB. (Note: It works best with fully saturated colors.)

See this page:
https://github.com/FastLED/FastLED/blob/master/hsv2rgb.cpp

Tip: Instead of converting pixel by pixel as the data comes in…
Serial.readBytes( (char*)(&leds[i]), 3); // read three bytes

Try reading in the full array of pixels and then converting them all to RGB at once, then show.

Serial.readBytes( (char*)ledsHSV, NUM_LEDS * 3);
hsv2rgb_rainbow( ledsHSV, leds, NUM_LEDS);
FastLED.show();

What’s sending the serial data btw? If it can’t send the data as RGB, could it send it as HEX, such as FF0000 (Red) for example? If you can’t receive it as RGB then HEX would be the next best option, then HSV and use hsv2rgb_rainbow.

NICE! Thanks for the protip. Actually i’m reading files from an sdcard that come in HSV. Really appreciated!!!