RGB values to HSB "color light" variable

    analogWrite(RED, redVal);
    analogWrite(GREEN, greenVal);
    analogWrite(BLUE, blueVal);

I use my RGB led strip like this with IoT cloud sliders, but now I want to control it with Alexa and it requires me to change this to "color light" variable. And cause I really dont know how to use this HSB variable Im stuck... Can someone help me with this?


Yeah I get that, but what I need is help or example of how to use CloudColoredLightvariable.

What library ?
Reading in internet I see somethig about a method of a library to get r/g/b part
like moodLight.getValue().getRGB(r, g, b);

I have IoT cloud project and I use RGB LED with sliders as I said above. But now I`d like to use Alexa which requires that I need to change my redVal, greenVal and blueVal int variables to this CloudColoredLight variable which does include switch and HSB LED control.

And cause my RGB was pretty simple I have no idea how to use CloudColoredLight...

I guess there is no need to convert RGB to HSB (I could be wrong though). I just need to switch RGB code to HSB code, but I couldn`t find any examples of that...

This worries me.
Did you GOOGLE:

arduino rgb to hsv

And find this.

Tom... :smiley: :+1: :coffee: :australia:
PS, Sorry but it is so simple, you want to know how to convert RGB to HSV with Arduino, GOOGLE it.

Yeah I did.

It seems that actually reading isn`t your strength... Like I said I´m not necessarily converting anything. What I need is help to use IoT cloud colored light function as it is meant to, cause it does not work with my code.


Is that what you need to understand.

So you do not want to convert but rewrite your project to work in purely HSV variables?

Tom... :smiley: :+1: :coffee: :australia:

This was it... Took me shamefully long to actually understand what I was doing. But anyway problem solved with this. Of course it needed a little tuning but works perfectly. I tried this at first with nano rp2040 bult in RGB led and colors were all over the place... But then I just bravely applied it to my project and it works as it should.