Stepper motor rotation control

diegoe:
Dear Friends. I have the following code to control the rotation of a stepper motor. However I need help in the following: I need only turn the engine by pressing the switch 90 and back to 0 ° to remove the switch. I can not find the solution ... is to control a small door (just open and close) is that it is simple .... but not what else to do .... please help. Thank you very much in advance. A greeting.-

This code causes the motor to rotate in one direction and then in another depending on the state of the switch. But I do not get to stop himself ....

Sorry, but I don't understand that.

What sort of switch do you have that you need to turn through 90 deg?

Post a link to the datasheet for the stepper motor you are using.

What stepper motor driver are you using?

...R
Stepper Motor Basics
Simple Stepper Code