Well in C there are no subroutines only functions. So you want to write a function to stop all your functions. Only you don't.
If you are going to stop a sequence then you need the ability to stop it when a logical variable ( known as a boolean variable ) becomes true. So this ability to stop a sequence must be built into the sequence itself.
This is not beginners stuff, and maybe it is beyond you at the moment but it is not too difficult to write when you know how to write code. To that end I have recently put up a tutorial Commutable Delay
This shows you how to write the sort of delay function that you can stop. The variable that shows a stop request has been made is called "commuted".
In addition to this you will need to also stop any for loops, so your for loops need to be written as
if( commuted ) { // don't even enter this loop if we have been told to stop
for(int i =0 ; i<max_Iterations ; i++) { // the start of your for loop
if( commuted ) i =max_Iterations; // end the loop if told to stop
// now check if the stop button has just been pressed
if ( digitalRead(changePin) == commuteState) commuted = true;
// now get on with what ever you want to do in this loop
} // now the for loop is finished
} // now the if statement that sees if you want to run the loop at all is finished
This will get you up to the commutableCatchPin function where you can sort out what to do with your code post emergency stop.
Well it gets things stoped but you have to think what happens when you take it out of sleep. I would thing this would require a processor reset.
I don't see where millis comes into it. If you want something simpler than I describe in my code above, but not as good, then consider a check of the stop button before issuing the move pulse.
Other options might include disabling the stepping motor driver when the stop button is pressed.
Thank you very much!
if it's not too much, could you please tell me the topics that I've to know?
i know the basics of programming in C but maybe with some specific information could do this FASTER, I've a project in mind before the year end.
thank you again!