How to use HSV rather than RGB
I would like to get to understand it a bit better and was wondering if you guys have any help you can give
I have been a constant user of RGB, as it has never let me down for what I need, however, I am beginning to understand that HSV is a much better way to be using colour.
At the moment I have only done one thing with it, and that is to light up an entire strip, changing colour slowly (https://gist.github.com/Tejkaran/6529577e4fa939392fc563d0a5eb4b78)
When I set the value to HSV(Hue++,255,255) then the colours change very gradually and it is so smooth that I cannot differentiate as to when the colour is changing.
when I change the settings to be HSV(Hue++,255,10) then it is really obvious when the colours are changing as the flick from one to the other.
Why does this happen?
I have tried changing the speed from 8mhZ to 12mhZ to 16 but it doesnt make much difference. So I dont think it is a speed thing.
Am I misunderstanding something here? Why does it not change smoothly when you change the value?
Also, I was looking at this website to understand HSV better(http://colorizer.org/) and it has a decent explanation on HSV. My question is why is the HSV value 0-255? Is this to do with the code being sent in uint8/8bytes? and thus 256 is 100% value?
You might try FastLED’s temporal dithering. This article also explains what might be happening: https://github.com/FastLED/FastLED/wiki/FastLED-Temporal-Dithering
You are correct, changing MHz speed isn’t going to make a difference.
Remember, even if you are using HSV, under the hood it is being converted to RGB before being sent out to the LEDs. Here’s how you can easily visually see what’s happening.
Go to this page:
And set Hue:0, Sat:100, and Brightness:100
Then drag the little Hue position indicator up/down while watching the RGB values. Then set Brightness:8 and watch the RGB values again while drawing the Hue position indicator up/down.
255 steps to ramp through, vs only 20 steps to ramp through!
[ http://colorizer.org is great btw, I only picked the above site as it has less options to look at so hopefully a bit easier to demo what’s going on here, but you can visualize this on the http://colorizer.org page also. ]
Bonus tip: In your code you can replace:
fill_solid(leds, NumPixels, CRGB(0,0,0)); // fill all black
thanks for the heads up, however that doest seem to be the issue. here are some videos showing what is going on:
at full brightness/value (hue++,255,255):
at middle brightness/value(hue++,255,50):
at low brightness/value(hue++,255,10):
It seems I am choosing the wrong approach…which brings me to @marmil , thanks for that colouring thing. It is good to see the values and it explains the videos above.
However, it doesnt really solve my issue, which brings me to ask the obvious, how can I set a brightness value? Yet maintain a fluid change in colour as seen at max brightness?
At the moment I am going through trying to replicate and understand some coding and specifically I am looking at the APA102 one by Pololu called Rainbow, with which you can change the brightness
(code is here - https://github.com/pololu/apa102-arduino/blob/master/examples/Rainbow/Rainbow.ino)