In a bind for tomorrow and need a good way to break HSV into its individual RGB component values. So that I can multiply it by the analog inputs from the sensor board to control the amount of r,g & b
All the sound programs use HSV to set the pixel.
I need to set them with something like this if anyone has an good idea on how to do it.
I’ll gladly PayPal a thank you if I can get this work tomorrow during the day.
Need to convert blink fade to account for the amount of analog 0,1 & 2 values read
I don’t have my pixelblaze with me, so I’ve typed this up without any validation – there might be errors when you paste it into the editor. I looked at a few hsv-to-rgb functions in JS and tried to adapt them to pixelblaze-compatible form. I used globals for r, g, b to keep it concise. Paste this above render(index):
var r, g, b
function hsv2rgb(hh, ss, vv) {
var h = hh % 1
var s = clamp(ss, 0, 1)
var v = clamp(vv, 0, 1)
var i = floor(h * 6)
var f = h * 6 - i
var p = v * (1 - s)
var q = v * (1 - (s * f))
var t = v * (1 - (s * (1 - f)))
if (i == 0) {
r = v; g = t; b = p
} else if (i == 1) {
r = q; g = v; b = p
} else if (i == 2) {
r = p; g = v; b = t
} else if (i == 3) {
r = p; g = q; b = v
} else if (i == 4) {
r = t; g = p; b = v
} else if (i == 5) {
r = v; g = p; b = q
}
}
You’d use it in blinkfade by replacing:
hsv(hues[index],1,v)
with
hsv2rgb(hues[index], 1, v)
rgb(
r * analogInputs[0],
g * analogInputs[1],
b * analogInputs[2]
)
Nice! So glad you got it working. No need for payment – just gift someone else a Pixelblaze to pay it forward, or help someone else on the forums sometime.