Emergency stop button for arduino mega code and circuit attached
The best option is to convert the delay() based code to a millis() based state machine. That way the code will never block and always be going through the loop and the place where you check wether that button was hit.

Then when that button is hit you transition to the E_STOP state which turns off all motors until the restart button is hit which goes to recalibrate the position if needed.



A more quick and dirty solution is to replace every every delay with 

unsigned long current = millis();
while(milis() - current &lt; delay){
    if(E_Stop()){
        stopped = true;
        return;
    }
}


And add a if check to bail out to every loop.

 for (/*...*/)      
  {
    //...
    delayMicroseconds(50);  
    if(E_Stop()){
        stopped = true;
        return;
    }
  }


At the start of loop() you then add a 

if(stopped){
    //check for restart signal if true recalibrate otherwise return
}