Hi, I am trying to use the HSV Spectrum colour map, but FastLED is using the Rainbow colour map by default. I have read FastLED HSV Colors · FastLED/FastLED Wiki · GitHub many times but still cant work out how to change it.
@marmil Thanks, i will try to work it out from that.
What i am actually trying to do use Amazon Alexa to control the LED strip, which it does but the hue’s are slightly off.
Alexa sends… 3 values back, Hue, Saturation and Value (Brightness).
Hue is in the range of 0 to 359
Saturation is 0.0000 to 1.0000
Brightness is 0.0000 to 1.0000
Alexa. Make light Green returns…
“hue”: 120, “saturation”: 1.0000, “brightness”: 1.0000
Make light Sky Blue returns…
“hue”: 197, “saturation”: 0.4231, “brightness”: 0.9176
I then map all the values from Alexa to the range of 0 to 255.
Here is my code for doing the conversion and mapping.
// Convert string "saturation" to a floating point then map it in the range of 0 to 255
float satCon = saturation.toFloat();
satCon = satCon * 10000; // Move the decimal 4 places to the Right
satCon = map(satCon, 0, 10000, 0, 255);
// Convert string "brightness" to a floating point then map it in the range of 0 to 255
float briCon = brightness.toFloat();
briCon = briCon * 10000; // Move the decimal 4 places to the Right
briCon = map(briCon, 0, 10000, 0, 255);
// convert string "hue" to an integer between 0 and 255
int hueCon = hue.toInt();
hueCon = map(hueCon, 0, 359, 0, 255);
delay(20);
FastLED.showColor(CHSV(hueCon, satCon, briCon));
delay(20);
There is probably a better way to do this, but i am quite new to coding. The code works, but the Hue’s are slightly out. Hence i need to change fastLED to use the Spectrum colour map. This i have not managed to do yet.
Great, glad to hear it @Jezz_Doobie !
Do you have any info or code shared about your project anywhere? My brother just got a Dot so now you’ve spurred my interest to do a project for him.