Since it seems as though the feature is not yet supported, does anyone have an example script for the button component that can reliably perform the Momentary function? I’m having a hard time replicating the function of the momentary button from Vision, and altering the PLC code is sub-optimal.
I wouldn’t be using momentary buttons in any SCADA platform. They are inherently flawed, as any comms hiccup will leave the bit high. I’ve seen this on many occasions
I suggest you fix it in the PLC by resetting the bit. If you need push-to-activate, then use a local hardwired input.
EDIT: If you (or rather the customer) really want to do it (which you/they shouldn’t), then you can use the onMouseDown and onMouseUp event handlers to write to the tag
Unfortunately, I’ve been asked to port over the vision functionality for a client without affecting the PLC (I do not have access to the PLC currently). So while I agree with your solution, my question still stands.
I had the same application where I could not alter the PLC code and needed a momentary script. This would write a tag on, delay 1.5 seconds, and then write it off again.
i have this issue how can i put it back the way it was ? i wrote this:
import time
system.tag.write("[default]IS15_Overheight_Rst_PB", 1)
time.sleep(1)
system.tag.write("[default]IS15_Overheight_Rst_PB", 0)
```now i want everything back to normal because my plc keep show 1 and that deactivates when the sensor is blocked but activates right way after the sensor is unblock. please advice