Logic Machine Forum
How to write 3 byte RGB value - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: How to write 3 byte RGB value (/showthread.php?tid=871)



How to write 3 byte RGB value - Mirco - 27.06.2017

Hi,

I want to set the color of RGB Led by HL, how can I write, for example, the blue color?
In ETS I write this way: 0 0 255  (the datatype is 232.600 - RGB value 3x(0..255))

Thanks!


RE: How to write 3 byte RGB value - admin - 27.06.2017

You can use hex value, like 0x0000FF for blue only.

Or specify color in 0..255 range like this:
Code:
r = 0
g = 0
b = 255

rgb = bit.bor(bit.lshift(r, 16), bit.lshift(g, 8), b)



RE: How to write 3 byte RGB value - Mirco - 27.06.2017

Thank you! Smile