sherzaad:
What I had in mind what something like to safely stop the code:
Don't use code for a safety stop.
Just have a big red button that cuts off power to the dangerous part of the machine.
As an extra you could have code in the Arduino that detects when the big red button is triggered - but only AFTER the safety stop has happened.
...R