Universal Robots Forum

Constant monitor of a digital input

I want to constantly monitor a digital input to call a safe stop or pause routine so that the robot will finish it’s current operation and then WAIT for a continue from another DI. Can I put this into a thread so that no matter where the robot is in its’ run, the program sees when this button has been pressed (and latched?) and complete the current task and then WAIT at a given point until continue is pressed. Likely putting it in a WAIT loop until the other DI is set.

@greg.matheson yes you can do that, you would need to add a thread to the program that monitors that input. Then when the input goes high you would set a flag. Then in your main program, you would hold at that flag until it goes low. In the same background thread, you can have the reset input reset the flag state which would allow the program to continue. I’ll mock up a sample and post it shortly

I recorded a short video on the simulator of adding this type of function to a program. It’s a simple example so let me know if you have any questions about it. You can find it here

1 Like