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.

LUA control shutter using reactor
#1
I wonder if there is any script to control shutters (position, up/down, stop) using reactor digital outputs?
Reply
#2
I was thinking about this task(as a challenge) and maybe I will prepare some script. It should be (in my opinion) combination of event-based script which will activate resident script and when blind is moving this resident script should control its relays in some wise way.
Done is better than perfect
Reply
#3
(28.07.2018, 11:21)Bitver Wrote: I wonder if there is any script to control shutters (position, up/down, stop) using reactor digital outputs?

try this

1/1/1 - button up
1/1/2 - button down
1/1/3 - motor up
1/1/4 - motor down
1/1/5 - position setpoint
1/1/6 - position status

event script for button up (name = gate_up)
Code:
123456789101112131415161718192021222324
up = event.getvalue() status = grp.getvalue('1/1/6') time = 65             -- movement time (sec.) step = time/100         -- delay step if up == true then  script.disable('gate_up')  script.disable('gate_down')     grp.write('1/1/3', true)  while up == true do    up1 = grp.getvalue('1/1/1')      if up1 == false then      status = status - 0      grp.write('1/1/3', false)        grp.write('1/1/4', false)      grp.write('1/1/6', status)      break    end    status = status + 1    os.sleep(step)    grp.write('1/1/6', status)     end  script.enable('gate_up')  script.enable('gate_down') end
event based script for button down (name = 'gate_down')
Code:
123456789101112131415161718192021222324
down = event.getvalue() status = grp.getvalue('1/1/6') time = 60             -- movement time (sec.) step = time/100         -- delay step if down == true then  script.disable('gate_up')  script.disable('gate_down')     grp.write('1/1/4', true)  while down == true do    down1 = grp.getvalue('1/1/2')    if down1 == false then      status = status - 0      grp.write('1/1/3', false)        grp.write('1/1/4', false)      grp.write('1/1/6', status)      break    end    status = status - 1    os.sleep(step)    grp.write('1/1/6', status)     end  script.enable('gate_up')  script.enable('gate_down') end
event script for position setpoint (name = position)
Code:
123456789101112131415161718192021222324252627282930313233343536373839
proc = event.getvalue() status = grp.getvalue('1/1/6') time = 65             -- movement time (sec.) step = time/100          -- delay step if proc - status > 0 then  grp.write('1/1/3', false)  grp.write('1/1/4', false)  os.sleep(0.25)     grp.write('1/1/3', true)    while status ~= proc do    proc = grp.getvalue('1/1/5')      status = status + 1    os.sleep(step)    grp.write('1/1/6', status)    if proc == status then      grp.write('1/1/3', false)        grp.write('1/1/4', false)      grp.write('1/1/6', proc)    end     end elseif proc - status < 0 then time = 60                   -- movement time (sec.) step = time/100             -- delay step  grp.write('1/1/3', false)  grp.write('1/1/4', false)    os.sleep(0.25)     grp.write('1/1/4', true)  while status ~= proc do    proc = grp.getvalue('1/1/5')    status = status - 1    os.sleep(step)    grp.write('1/1/6', status)    if proc == status then      grp.write('1/1/3', false)        grp.write('1/1/4', false)      grp.write('1/1/6', proc)    end  end end
Reply


Forum Jump: