A little curiosity. A whole lot of making.Robotics, CNC & connected ideas
robodatech.
Arduino sample library

Stepper Driver 27

Move stepper motors with the bundled Stepper library.

Open in compiler →
/*
  Roboda verified Arduino sample 0665
  Feature: Stepper Driver
  Generated for online build, classroom practice, and hardware upload testing.
*/

#include <Stepper.h>

const int stepsPerRevolution = 200;
Stepper motor(stepsPerRevolution, 8, 9, 10, 11);

void setup() {
  motor.setSpeed(46);
}

void loop() {
  motor.step(stepsPerRevolution / 8);
  delay(150);
}

How it works

Practice this Arduino feature with a verified Roboda sketch.

  1. Read the constants at the top of the sketch.
  2. Wire the pins exactly as listed in the pin map.
  3. Upload or compile once before changing values.
  4. Change one value at a time and watch Serial Monitor or the output device.

Connections

PinConnect toNote
D8, D9, D10, D11Stepper driver inputs or ULN2003 IN1-IN4Do not power a stepper directly from Arduino pins.

Good ideas start here.

Robotics lessons, build notes and useful updates. Subscribe by entering your email.