Is it possible to use a spread of 16 colours on one EN16 encoder, ie cc output value 0-7 blue, 8-15 purple, 16-23 green etc?
What would be the best way to approach this?
Hi!
best approach now would be to hold the rgb colors in a global table and make a function which calls the right LED color. The current character limitation might be tricky to tackle, but here is some pseudo code to help you.
Global table for 16 colors:
clr = {{0,100,200},{200,50,10}, etc...}
The function:
function getClr(in)
local index = in // 16
-- i'm not sure if +1 is needed, but lua tables are referenced with 1 as starting index
return clr[index + 1]
end
The above function and table can be put under system events. Then on a control element you can add a code block or put this in the Locals action block…
local c = getClr(self:encoder_value())
Add a Color action block (or call it by function) and use the R,G,B values of the getClr function.
led_color(self:element_index(), 2, c[1],c[2],c[3] )
The intensity should be set to 100 on layer 2 to make your changes visible.
Thanks
Looks like I’m studying lua code today!
1 Like
You’re welcome. Please respond to either of your threads if you get stuck! Happy exploring.