Logic Machine Forum
Not sending 6byte RGBW 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: Not sending 6byte RGBW value ! (/showthread.php?tid=6007)



Not sending 6byte RGBW value ! - phongvucba - 27.05.2025

Hi everyone! 
I am having trouble with sending 6byte RGBW value. I can't send value to it, for example I want to send value #EB00EB to address 1/7/0 , but it gives error.
------------
grp.write('1/7/0', #EB00EB)
------------


RE: Not sending 6byte RGBW value ! - admin - 27.05.2025

You must pass a table as the value for 6-byte RGBW. Each color is in 0..255 range.
Code:
grp.write('1/7/0', {
  red = 255,
  blue = 0,
  green = 127,
  white = 127
})

Standard RGB/RGBW types use numeric values which can be specified in hexadecimal form as 0xRRGGBB or 0xRRGGBBWW respectively.


RE: Not sending 6byte RGBW value ! - phongvucba - 28.05.2025

Thanks Admin. so much !


RE: Not sending 6byte RGBW value ! - phongvucba - 12.06.2025

Hi everyone!
Today I tried the value is 3byte color (3byte format is: 232,600 RGB color). I want to write this value but it does not do #FFA33A to the value 2/7/42
grp.write('2/7/42', { red = 255, green = 163, blue = 58})
Does anyone know why?
Thank you very much everyone!


RE: Not sending 6byte RGBW value ! - Erwin van der Zwart - 12.06.2025

Unlike the 6 byte that requires a table to be passed is the 3 byte an integer (you can check this by logging the value it reports)

Just use:
Code:
grp.write('2/7/42', 0xFFA33A)
 or
Code:
r = 255
g = 163
b = 58
rgb = lmcore.hextoint(lmcore.inttohex(r,1) .. lmcore.inttohex(g,1) .. lmcore.inttohex(b,1))
grp.write('2/7/42', rgb)



RE: Not sending 6byte RGBW value ! - admin - 13.06.2025

This should be helpful too: https://kb.logicmachine.net/scripting/rgb-rgbw/#combine-3x-1-byte-objects-into-rgb-3-bytes