Code to send Stepper to a home position.

Hi

I have a Arduino UNO microcontroller with a Adafruit shield connected to a stepper motor. I want to be able to Home to a sensor switch and then step to different locations from the home position. Can anyone share some code to get me started? I want to push a button and have the stepper rotate backwards or fordwards until it contacts a sensor switch and set this as the home position. I would then use other buttons to step to diferent positions. Thanks Rmac

I have done the examples you suggested and have a sketch started. What I am looking for if a sample code for sending a stepper to a home position. If anyone has done one and is willing to share it would help. Rmac

If anyone has done one and is willing to share

Show me yours and I wil show you mine ... :)

Seriously, show us your code.

The logic is simple

S.SetSpeed(somethingslow) ; 
S.step(3) ; // move forward a little in case we already ar at home.
while (digitalRead(pinwithswitch)==HIGH)   S.step(-1) ;
 // Stepper at home position

This will step one step and after each step check if the home-switch is depressed (it goes LOW). Then it will exit the loop (and the stepper is standing still)