Can you set the colour of individual LEDs based on their physical location along the string? #18
-
Is there a way of setting the colour of individual LEDs based on their physical location along the device. Let's say I have a cluster set, with LEDs in a linear array along the length of the string. Does the hardware address each LED based on an index into it's physical position along the string, does it know this information or does it require calibrating the device when in a line/unrolled first. Could I set every fourth LED in the string to a particular colour? etc? Can this be done using this API? Thanks. Max |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes it is indeed possible. The function Note that many devices have two strings emanating from the device, and the ordering of the leds start at one string closest to the device and goes to the tip of that string, then starts from closest the device on the other string and goes to the tip. So if you arrange them in a line with the device in the middle, or in a circle where the two tips touch each other, the indices would make a jump in the middle, from the tip of on string to the base of the other. Then you can set the optional argument The specific pattern you are mentioning, to set every fourth led to the same color, is actually already provided in "pattern.py": The function |
Beta Was this translation helpful? Give feedback.
Yes it is indeed possible.
The function
make_func_pattern
in HighControlInterface produces a pattern based on the led index along the string. It takes a function as argument, which in turn takes the index of one led and returns the color of that specific led as an (r,g,b)-tuple.Note that many devices have two strings emanating from the device, and the ordering of the leds start at one string closest to the device and goes to the tip of that string, then starts from closest the device on the other string and goes to the tip. So if you arrange them in a line with the device in the middle, or in a circle where the two tips touch each other, the indices would make a jump in the middle, from …