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.

“staircase function”
#1
Hello,

As a "newcomer" to LM5 as well as Lua scripting, I am struggling with a script, that features kind of a staircase function and that could be parametrised separately to implement a time-controlled lighting of a staircase or similar applications.

- The script would be triggered by a “1 bit object” originating from a motion-sensor
- The script would then dim-on the corresponding lights by sending a “1 byte object” to the dimmer
- Then the script would wait a delay time, after that it would dim down the lights by sending several decreasing values, also with some short delay in between

Well, so far, this was straight forward to implement.

Code:
value = event.getvalue()

if value==true then

  grp.write('9/1/3',100)
 
  sleep(90)

  grp.write('9/1/3',50)
 
  sleep(15)

  grp.write('9/1/3',30)
 
  sleep(3)
 
  grp.write('9/1/3',15)
 
  sleep(3)
 
  grp.write('9/1/1',false)
 
  end


Only, there would be some “extra features” needed:

a) When an another 1 bit object = 1, originating from a motion-sensor would be received during the script-execution, it should reset the initial delay time —> “staircase function” (means, restarting the script immediately)

b) When an object = 1 originating from a wall-switch would be received during the script-execution, it should stop the script, dim up the lights and disable the motion-sensor

c) When an object = 0 originating from a wall-switch would be received during the script-execution, it should stop the script, dim down the lights and disable the motion-sensor


Thank you very much.
Reply


Messages In This Thread
“staircase function” - by Boris - 11.02.2020, 17:26
RE: “staircase function” - by Boris - 12.02.2020, 22:04
RE: “staircase function” - by alexgleyzer - 29.02.2020, 13:25

Forum Jump: