03.08.2016, 06:19
You can create a sequence with any number of outputs this way, just modify the parameters and object list to suit your needs:
Code:
mintimer = 5 -- minimum timer value in seconds
maxtimer = 60 -- maximum timer value in seconds
objects = {
{
output = '1/1/1',
timer = '2/1/1',
},
{
output = '1/1/2',
timer = '2/1/2',
},
{
output = '1/1/3',
timer = '2/1/3',
}
}
function dosleep(obj)
local timer = grp.getvalue(obj)
timer = tonumber(timer)
if timer then
if timer < mintimer then
timer = mintimer
elseif timer > maxtimer then
timer = maxtimer
end
sleep(timer)
end
end
for _, item in ipairs(objects) do
grp.write(item.output, true)
dosleep(item.timer)
grp.write(item.output, false)
end