This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Dali Light secuence
#1
Hello,

We are doing a temporary project for an exhibition and I need to make a script that sends different values of regulation during a specific time to create light effects in an installation, 


(for example. initial value 20% -> (10sec) -> 60% -> (10sec) -> 75%) 

these sequences will have to be repeated without stopping when turning on the LogicMachine.
I would like to know how I can do these LM regulation ramps and how do I run it at startup?

Thank you very much.
Reply
#2
Hi Josep,

Try this in a resident script, interval time doesn't matter.

Code:
outputaddress = '1/1/1' -- byte object

-- set step values
value1 = 20
value2 = 40
value3 = 60
value4 = 80
value5 = 100

-- set init value
value = value1

-- set delay
delaytime = 10

-- loop always
while true do
 -- check if value 1 needs to be written
 if value == value1 then
   value = value2
   grp.write(outputaddress, value1)
 -- check if value 2 needs to be written
 elseif value == value2 then
   value = value3
   grp.write(outputaddress, value2)
 -- check if value 3 needs to be written
 elseif value == value3 then
   value = value4
   grp.write(outputaddress, value3)
 -- check if value 4 needs to be written
 elseif value == value4 then
   value = value5
   grp.write(outputaddress, value4)
 -- check if value 5 needs to be written
 elseif value == value5 then
   value = value1
   grp.write(outputaddress, value5)
 -- fallback when value not valid
 else
   value = value1
 end
 -- delay loop
 os.sleep(delaytime)
end

When changing one of the declared values you need to restart the script.

If you reboot LM the sequense starts automaticly again as long as your resident script is having the active state.

BR,

Erwin
Reply
#3
(06.02.2017, 19:10)Erwin van der Zwart Wrote: Hi Josep,

Try this in a resident script, interval time doesn't matter.

Code:
outputaddress = '1/1/1' -- byte object

-- set step values
value1 = 20
value2 = 40
value3 = 60
value4 = 80
value5 = 100

-- set init value
value = value1

-- set delay
delaytime = 10

-- loop always
while true do
 -- check if value 1 needs to be written
 if value == value1 then
   value = value2
   grp.write(outputaddress, value1)
 -- check if value 2 needs to be written
 elseif value == value2 then
   value = value3
   grp.write(outputaddress, value2)
 -- check if value 3 needs to be written
 elseif value == value3 then
   value = value4
   grp.write(outputaddress, value3)
 -- check if value 4 needs to be written
 elseif value == value4 then
   value = value5
   grp.write(outputaddress, value4)
 -- check if value 5 needs to be written
 elseif value == value5 then
   value = value1
   grp.write(outputaddress, value5)
 -- fallback when value not valid
 else
   value = value1
 end
 -- delay loop
 os.sleep(delaytime)
end

When changing one of the declared values you need to restart the script.

If you reboot LM the sequense starts automaticly again as long as your resident script is having the active state.

BR,

Erwin

Thank you so much!!!
Reply


Forum Jump: