Do something but wait 3 seconds first
I need a way to give a 3 second delay or pause when an ONCHANGE
tag value occurs so I can keep the deadband logging enabled with a 1 value for another 3 seconds.
I need a way to put a sleep or delay command in an ELSE
condition of an IF
statement so if the condition is not true, wait 3 seconds and then run the command(s) there just one time only.
This should then make the deadband value change whether that be a call to another routine or whatever is needed to make that happen after the delay period only once.
I’ve dummied down some logic running on a Flexy 205 to give an example of what I’m running now logic wise that I need to adjust for a 3 second delay within the ELSE
portion of the IF
condition.
BASIC IDE Logic
ONCHANGE "HOPPER2_SETPOINT_MET", "GOTO Hopper2_SetPointMet"
TSET 1, 60
ONTIMER 1, "Goto CheckVPN"
TSET 2, 30
ONTIMER 2, "Goto eSync"
END
Hopper2_SetPointMet:
IF(HOPPER2_SETPOINT_MET@ < 1) THEN
LOGIO "HOPPER2_LIVEWEIGHT"
SETSYS TAG, "load","HOPPER2_LIVEWEIGHT" // -- Load Tag
SETSYS TAG, "LogEnabled", 1 // -- Enable historical logging
SETSYS TAG, "LogDB", 1 // -- Enable deadband logging
SETSYS TAG, "save"
LOGIO "HOPPER2_LIVEWEIGHT"
ELSE
LOGIO "HOPPER2_LIVEWEIGHT"
SETSYS TAG, "load","HOPPER2_LIVEWEIGHT" // -- Load Tag
SETSYS TAG, "LogEnabled", 1 // -- Enable historical logging
SETSYS TAG, "LogDB", -9 // -- Disable deadband logging
SETSYS TAG, "save"
LOGIO "HOPPER2_LIVEWEIGHT"
ENDIF
END