Logic Machine Forum
counting script with rgbw - 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: counting script with rgbw (/showthread.php?tid=5023)



counting script with rgbw - Danny - 13.10.2023

Dear readers,

A customer of ours wants the following:
There is a knx motion detector on a toilet.
The toilet contains RGBW spotlights controlled by a Zennio x4
Now there must be a sequence that shows the same color 9 times and this must be adjustable yourself.
and the 10th time there must be a random rgbw disco light.
where the speed can be adjusted.
and after the 10th time a reset so that everything starts again from the beginning.

Does anyone have experience with this script?

yours sincerely


RE: counting script with rgbw - Daniel - 13.10.2023

What is a disco light? A random color or what?


RE: counting script with rgbw - Danny - 13.10.2023

That is a loop of different colors that appear irregularly


RE: counting script with rgbw - admin - 13.10.2023

Random RGBW value example: https://forum.logicmachine.net/showthread.php?tid=3748&pid=24187#pid24187


RE: counting script with rgbw - Danny - 13.10.2023

And how can I create a counter and have a reset to 0 when I pass 10?


RE: counting script with rgbw - admin - 13.10.2023

This will write a random RGBW value 10 times with 1 second delay between each write:
Code:
math.randomseed(os.time())

for i = 1, 10 do
  r = math.random(0, 255)
  g = math.random(0, 255)
  b = math.random(0, 255)
  w = math.random(0, 255)

  rgbw = r * 0x1000000 + g * 0x10000 + b * 0x100 + w

  grp.write('1/1/13', rgbw)

  os.sleep(1)
end