Hey guys quick question,

(Nicholas Tracy) #1

Hey guys quick question, anyone have a suggestion for blending the transitions between colors in this code snippet?

for (int i = 0; i < 20; i++) {
leds[i] = CHSV(0, 255, val3);
for (int i = 20; i < 40; i++) {
leds[i] = CHSV(0, 0, val3);
for (int i = 40; i < 60; i++) {
leds[i] = CHSV(95, 255, val3);

basically i have a strip of 40 ws2812Bs val3 is a variable to change the dimming of the strip via external controls, everything is in HSV. the first section of the strip (leds 0 - 19) should be Red, middle section (20 - 40) should be white, and last section (40-60) should be Green. it all works fine except i want there to be a blending of the colors right at the lines. so say between leds 17 and 22 red would blend in to the white. anyone have any ideas on how to do this easily?

(Nicholas Tracy) #2

i think i have it figured out. another question i have is. is there a method to translate rgb values to hsv values in fast led? i need to convert an incoming thingspeak value thats rgb to hsv to function with the rest of my hsv code functions.

(Stefan Petrick) #3

Here you’re looking for
CHSV rgb2hsv_approximate( const CRGB& rgb);
Check http://fastled.io/docs/3.1/hsv2rgb_8h_source.html for some details about it.

(Nicholas Tracy) #4

Thank you very much. I attempted to look through the docs but its so disorganized and hard to understand if you don’t know what your looking for. i assume by the looks of it that its auto generated from the library source code itself. need more humanizing language.