[AMENDED topic] Detecting an Emergency Stop on Arduino

the intent is to recognise that there was an eStop request and stop the code there and then. Since the arduino is connected to a PC, killing power to the board is not really an option.

Currently and eStop button will stop the physical process when pressed but the code keeps running.

Implementing my initial post works to detect the eStop request, but it still needs to completed the loop before detecting the eStop set

What I had in mind what something like to safely stop the code:

On intr, eStop = 1 -> safely stop code then Goto 0 (which the start of the loop)