Aborting a program using digital input

Currently have a process running within a program where an external digital input for aborting the program is used to send the robot to a safe home position when the input becomes high. At the moment a loop is in place, with the entirety of the program, besides the routine to get to safe home, is inside it. When the signal becomes high, the program leaves the loop and completes the moves to get to safe home. However, this means when the program runs it only shows it being inside the loop but not what part of the program is running. Does anyone have a better way of doing this? I have thought about using a constantly monitored if statement but will that just do the same thing?

It should show which part of the sequence is executed within a Loop, as well. Which PolyScope version are you running? Maybe an update will fix it. :slight_smile:
You can definitely use an If statement as an alternative. I would make an Event that monitors your button and sets a variable to True, if the button is pressed.
Then use this variable to exit the If sequence and enter another If sequence after the first, which looks at the variable being True. This second If sequence will move the robot to its home position.

Also, remember to use stopj() or stopl() if you can stop the robot in a movement. :slight_smile:

Does this make sense? I can make an example for you, if you want it.

Thank you! That’s really helpful, an example would be appreciated if you can. The robot is running polyscope 5.14.6 but it is a continuously monitored loop so could that have something to do with not being able to see where the program is?

I’m not sure why that isn’t showing. I just checked, and it doesn’t show for me either. It is indeed only happening when it’s checking the expression continously.
Here’s a quick example. :slight_smile: