Skip to content

Stepper motor driver for Arduino with linear acceleration handling.

License

Notifications You must be signed in to change notification settings

toxnico/DMStepper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();

About

Stepper motor driver for Arduino with linear acceleration handling.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published