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.

Blink Output LM5R
#1
Hi

I need a digital output from the reactor that makes a lamp flash. Is it possible to create a reusable function that does this, passing it the flashing time?

Thank you very much.
Reply
#2
Resident script, get value and write back 'not value'
------------------------------
Ctrl+F5
Reply
#3
Add to Common functions:
Code:
function blink(event, addr, delay)
  local obj = grp.find(addr)
  if not event.getvalue() then
    obj:write(false)
    return
  end
 
  local value = obj.value
  while true do
    value = not value
    obj:write(value)
    os.sleep(delay)
  end
end

Create a boolean object and map an event script to it. Set Execution mode to "Last instance only".
0/0/2 is the output control group address.
3 is delay in seconds between each on/off.
Code:
blink(event, '0/0/2', 3)

Writing true to the event script object will start the blinking. Writing false will stop it and will turn the output off.
Reply


Forum Jump: