Stepper Motor control with 1 limit switch

Take a look into Arduino/reference section switch.... case. Let one case be adjuting forward and the other case be adjusting backwards.