Skip to content
Stepper motor driver for Arduino with linear acceleration handling.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples/basic-usage
src corrections on runTo() method May 20, 2018
.gitignore work in progress May 15, 2018
LICENSE Initial commit May 13, 2018
Makefile
README.md
keywords.txt ready for release May 17, 2018
library.properties

README.md

DMStepper

Stepper motor driver for Arduino. It handles linear acceleration and deceleration.

To initiate a move on a motor, call its run method with the following parameters:

  • direction : 1 or -1
  • max speed in steps/s
  • number of steps to go

Then in the loop() function, just call motor's update() method to actually move it.

If update() is called when the complete move is finished (or not initiated), it will do nothing. So update() can be called at any time.

//Create a motor, telling the direction and step pins
DMStepper motor(dirPin, stepPin);

motor.acceleration = 15000;

//Run the motor for 10000 steps, at a max speed of 3000 steps/s
motor.run(1, 3000, 10000);

//get or set the current position in steps
motor.currentPosition;

//Run the motor to the absolute position of 1640 steps, at 3000 steps/s max
motor.runTo(1640, 3000);


//And in the loop() function:
motor.update();
You can’t perform that action at this time.