Logic Machine Forum
grp.checkwrite() with delay - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: grp.checkwrite() with delay (/showthread.php?tid=3336)



grp.checkwrite() with delay - benanderson_475 - 01.05.2021

is there such a function grp.checkwrite() after a specified delay time has expired?

I have some inputs and outputs for the associated inputs
I need to flag an error if after i turn the on an output, and after a delay of 30 sec or less depending on each input,  if the input dose not activate.

What is the best way to achieve this?
Currently i have event script on the output to check the state of the input but it is happening to fast and the input hasn't had time to change before i read it.
i can use os.sleep(), but i need this to be a blocking read, and it is only a short delay just long enough to allow time for the input to change before i read it again.

Or is it possible to in the output/s event script to wait until '1/1/12' (input address) changes state before continuing with the event script? 

Many Thanks


RE: grp.checkwrite() with delay - Daniel - 04.05.2021

You should compare updatetime from both objects. To do it use grp.find and you will get all info. Here is example of another script where grp.find is used to compare times. In your example you will need to compare two objects instead like here with os.time


RE: grp.checkwrite() with delay - benanderson_475 - 04.05.2021

(04.05.2021, 07:23)Daniel. Wrote: You should compare updatetime from both objects. To do it use grp.find and you will get all info.  Here is example of another script where grp.find is used to compare times. In your example you will need to compare two objects instead like here with os.time

Ok I log grp.find(‘1/1/12’) and I return in table with the update time etc, I can get both update times for the objects and have a while loop to check which one was last changed? 
Or when the input update time > output update time then break loop and continue etc


RE: grp.checkwrite() with delay - Daniel - 04.05.2021

Use resident script to keep checking it periodically.


RE: grp.checkwrite() with delay - benanderson_475 - 05.05.2021

(04.05.2021, 09:40)Daniel. Wrote: Use resident script to keep checking it periodically.

Thanks Daniel, I have it working how i need it,

Many thanks