06.02.2017, 19:25
(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!!!