Arduino Leonardo with Motor Shield and 4-wire stepper motor
Parts used
- 2 9-Volt batteries
- Arduino Leonardo
- PKA03-1 Motor Shield
- QSH 4218 Stepper motor




#include const int stepsPerRevolution = 200; const int pwmA = 3; const int pwmB = 9; const int dirA = 2; const int dirB = 8; Stepper myStepper(stepsPerRevolution, dirA, dirB); void setup() { pinMode(pwmA, OUTPUT); pinMode(pwmB, OUTPUT); digitalWrite(pwmA, HIGH); digitalWrite(pwmB, HIGH); myStepper.setSpeed(100); } void loop() { myStepper.step(stepsPerRevolution); delay(1000); }