C++ class library that controls a stepper motor, Created it for stepper motor 28BYJ-48, after other code examples didn't work well.
You can look at the Arduino example file.
Steps:
- Clone repository, or download
StepMotor.h
andStepMotor.cpp
(put them in your arduino project folder) - Include library inside arduino (.ino) file
#include "StepMotor.h"
- Create
StepMotor
instance
StepMotor stepper(8,9,10,11);
- 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);