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.
Diff: mMotor.h
- Revision:
- 0:acf5b8fc382b
- Child:
- 1:6e0a307d0f9b
diff -r 000000000000 -r acf5b8fc382b mMotor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mMotor.h Wed Apr 24 17:39:30 2013 +0000 @@ -0,0 +1,37 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 + + void step(int num_steps, int direction, int speed); + void counterclockwise(); + void clockwise(); + + +private: + + DigitalOut _M0; + DigitalOut _M1; + DigitalOut _M2; + DigitalOut _M3; + +}; + +#endif \ No newline at end of file