This is a library that drives a stepper motor with given parameters for speed and direction.
About
This is a stepper motor library that is based on the sMotor library by Samuel Matildes (sam.naeec@gmail.com). It was designed to drive specifically a 5718m-05e-05 stepper motor in conjunction with an L293NE quad h-bridge chip. I am not responsible for any damage caused due to the execution of this program on your hardware as I can only confirm that it works for the above specified model. High torque mode is currently not complete.
mMotor.h
- Committer:
- mdu7078
- Date:
- 2013-05-13
- Revision:
- 1:6e0a307d0f9b
- Parent:
- 0:acf5b8fc382b
File content as of revision 1:6e0a307d0f9b:
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is a stepper motor library for testing *
* 4 step stepper motors. The speed of stepping is *
* variable as well as the amount of steps. *
* ------------------------------------------------- *
* This library is based on the sMotor library by *
* Samuel Matildes (sam.naeec@gmail.com). *
* ------------------------------------------------- *
* *
* Created by: Michael Dushkoff (mad1841@rit.edu) *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef MBED_MSTEPMOTOR_H
#define MBED_MSTEPMOTOR_H
#include "mbed.h"
class mMotor {
public:
mMotor(PinName M0, PinName M1, PinName M2, PinName M3); //motor constructor
/* Low Torque mode */
void step(int num_steps, int direction, int speed);
void counterclockwise();
void clockwise();
/* High Torque mode */
void ht_step(int num_steps, int direction, int speed);
void ht_counterclockwise();
void ht_clockwise();
private:
DigitalOut _M0;
DigitalOut _M1;
DigitalOut _M2;
DigitalOut _M3;
};
#endif