Stepper.h library on Arduino

Documentation:

If you need more detail you can always read the sources.