Home ArduinoArduino Code Arduino stepper motor example

Arduino stepper motor example

The motor driver board contained a ULN2003

This is mainly one of the default examples that comes with the stepper library

Code

#include <Stepper.h>

const int stepsPerRevolution = 512;

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 4,5,6,7);

int stepCount = 0;

void setup()
{
// initialize the serial port:
Serial.begin(9600);
}

void loop()
{
myStepper.step(1);
Serial.print(“steps:” );
Serial.println(stepCount);
stepCount++;
delay(500);
}

 

Links

Here is a link to the board and stepper motor
5V 4-phase DC Gear Stepper Motor + Driver Board on Amazon UK

Stepper Motor 28BYJ-48 DC 5V 4-Phase 5-Wire Arduino with ULN2003 Driver Board on Amazon US

You may also like