Skip to content

AmitBu/stepper-motor-control

Repository files navigation

Stepper motor control

C++ class library that controls a stepper motor, Created it for stepper motor 28BYJ-48, after other code examples didn't work well.

How to use

You can look at the Arduino example file.

Running the sample code (Running the example code)

Steps:

  1. Clone repository, or download StepMotor.h and StepMotor.cpp (put them in your arduino project folder)
  2. Include library inside arduino (.ino) file
#include "StepMotor.h"
  1. Create StepMotor instance
StepMotor stepper(8,9,10,11);
  1. Use instance to control stepper, examples:
// Rotate clockwise 1000 steps
stepper.rotateClock(1000);

// Rotate counter-clockwise 1000 steps:
stepper.rotateCounter(1000);

// Rotate in the direction you choose (`1` - clockwise, `-1` - counter-clockwise)
stepper.rotate(-1, 1000);

About

Arduino stepper motor library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages