Logic Machine Forum
toggling an object - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: toggling an object (/showthread.php?tid=25)



toggling an object - rocfusion - 08.07.2015

Hi,

Is there an direct way to add visualize a pulse object.  lets take an gate contact as an example,  when a pulse ( 1 and then 0 ) is given on the object the gate will open or close.  Typically with a light in the visu, the switch\button goes on,  stays on and turns off when you press it again.  With an pulse object it will go off about 0.5 from turning on.

I guess the only way this would be achieved is an event script on the pulse object.  something like.

Code:
if event.type == 'groupwrite' then
  obj = grp.find(event.dst)
  if obj and obj.decoded then  
    if obj.value == true then
      os.sleep(0.5)
      grp.write(event.dst, false, obj.datatype)
    end
  end
end

Thanks,

Roger