Purchased 200pix addressable light string to replace older incandescent lights for a year-round holiday tree. I am starting off very simple with just a static display to mimic what a traditional light string would be. There is a “Christmas string lights by @jvydunapatten” on the pattern site that does this exactly as needed, the twinkle effect is a nice touch too. However with all things, being satisfied with the basics just didn’t last very long.
Throughout the year I will want to change the colors to match the season/holiday and the way the array is configure does not lend well to doing more pastel type colors as the saturation is static across the board. My initial thought was to change to rgb instead of hsv as I think it’s easier to deal with, but I figure I’ll stay “natively” with hsv just because why not try and learn something new. Well, I hit that wall pretty quick too as my programing skills are far from adequate.
Also ideally I want this to be more kid friendly, so instead of using direct values, I want to leverage the colorpicker function.
First thing first was that I pared down the initial script for easier testing, and that continues to work as expected.
numHues = 2
hues = array(numHues)
hues[0] = 0.995
hues[1] = 0.6
export function render(index) {
hue = hues[index % numHues]
twinkle = random(1) < 0.999 // clock speed dependent
hsv(hue, 1, twinkle)
}
Secondly I incorporated to the colorpicker, but just in the s and v sense to see how that worked, and that worked as expected.
export function hsvPickerColor(s, v) {
saturation = s
value = v
}
numHues = 2
hues = array(numHues)
hues[0] = 0.995
hues[1] = 0.6
export function render(index) {
hue = hues[index % numHues]
hsv(hue, saturation, value)
}
And this is where I start failing already in this understand on how arrays work when wanting to control hues by variable with it not liking the ‘hues[0] = h’ line
export function hsvPickerColor(h, s, v) {
hue = h
saturation = s
value = v
}
numHues = 2
hues = array(numHues)
hues[0] = h
hues[1] = 0.6
export function render(index) {
hue = hues[index % numHues]
hsv(hue, saturation, value)
}
Obviously that’s only going to control the hue anyway, so when trying to incorporate s and v too, now I’m even more lost.
export function hsvPickerColor(h, s, v) {
hue = h
saturation = s
value = v
}
numColors = 1
Colors = array(numColors)
Colors[0] = h,s,v
export function render(index) {
hsv(Colors)
}
End result is that I want multiple pickers (up to 5 or 6), and it comes down on how to incorporate that. Is it possible to incorporate h,s,v in to a single ‘Colors’ variable?
export function hsvPickerColor1(h1, s1, v1) {
hue1 = h1
saturation1 = s1
value1 = v1
}
export function hsvPickerColor2(h2, s2, v2) {
hue2 = h2
saturation2 = s2
value2 = v2
}
numColors = 2
Colors = array(numColors)
Colors[0] = h1, s1, v1
Colors[1] = h2, s2, v2
export function render(index) {
hsv(Colors)
}
I suppose more ideally too I’d like to keep the twinkle effect as well, so taking out the value from the picker.
export function hsvPickerColor1(h1, s1) {
hue1 = h1
saturation1 = s1
}
export function hsvPickerColor2(h2, s2) {
hue2 = h2
saturation2 = s2
}
numColors = 2
Colors = array(numColors)
Colors[0] = h1, s1
Colors[1] = h2, s2
export function render(index) {
twinkle = random(1) < 0.999 // clock speed dependent
hsv(Colors, twinkle)
}
Are arrays even the best at this point anyway or should something else be used? At this point I’m kind of lost on how to achieve both ease of use with the picker, and to implement that to alternating static pix.