/*
https://arduino-info.wikispaces.com/SmallSteppers
5v 28YBJ-48 Stepper Motor with Gear Reduction
ULN2003 driver board
*/
#include
// internal motor steps per revolution in 4-step mode
#define STEPS_PER_MOTOR_REVOLUTION 32
// steps per OUTPUT SHAFT of gear reduction
#define STEPS_PER_OUTPUT_REVOLUTION (STEPS_PER_MOTOR_REVOLUTION*64)
//The pin connections need to be 4 pins connected
// to Motor Driver In1, In2, In3, In4 and then the pins entered
// here in the sequence 1-3-2-4 for proper sequencing
Stepper s(STEPS_PER_MOTOR_REVOLUTION, 8, 10, 9, 11);
void setup()
{
s.setSpeed(500); // 700 good max?
}
void loop()
{
s.step(2 * STEPS_PER_OUTPUT_REVOLUTION); // CW 1 turn
s.step(-STEPS_PER_OUTPUT_REVOLUTION); // CCW 1 turn
delay(500);
}