Stepper motors are special types of motors used to turn with a high degree of accuracy. There are two types of steppers, Unipolars and Bipolars. Each type of motor requires different type of circuit to control and move them. This example code/sketch for an Arduino or Genuino will control both kinds of motors. This code, will turn a stepper motor clockwise a quarter turn at a time. The stepper motor is controlled with digital pins 8, 9, 10, and 11 of an Arduino board for either unipolar or bipolar motors.
This code should work with the any of the following motor drivers (or similar) and any motor they can drive electronically:
- U2004 Darlington Array (if using a unipolar stepper)
- SN754410ne H-Bridge (if using a bipolar stepper)