This is a library that drives a stepper motor with given parameters for speed and direction.

Dependents:   RaceTimer

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.

Committer:
mdu7078
Date:
Mon May 13 16:19:54 2013 +0000
Revision:
1:6e0a307d0f9b
Parent:
0:acf5b8fc382b
First commit of mMotor library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mdu7078 0:acf5b8fc382b 1 /* * * * * * * * * * * * * * * * * * * * * * * * * * *
mdu7078 0:acf5b8fc382b 2 * This is a stepper motor library for testing *
mdu7078 0:acf5b8fc382b 3 * 4 step stepper motors. The speed of stepping is *
mdu7078 0:acf5b8fc382b 4 * variable as well as the amount of steps. *
mdu7078 0:acf5b8fc382b 5 * ------------------------------------------------- *
mdu7078 0:acf5b8fc382b 6 * This library is based on the sMotor library by *
mdu7078 0:acf5b8fc382b 7 * Samuel Matildes (sam.naeec@gmail.com). *
mdu7078 0:acf5b8fc382b 8 * ------------------------------------------------- *
mdu7078 0:acf5b8fc382b 9 * *
mdu7078 0:acf5b8fc382b 10 * Created by: Michael Dushkoff (mad1841@rit.edu) *
mdu7078 0:acf5b8fc382b 11 * * * * * * * * * * * * * * * * * * * * * * * * * * */
mdu7078 0:acf5b8fc382b 12
mdu7078 0:acf5b8fc382b 13 #ifndef MBED_MSTEPMOTOR_H
mdu7078 0:acf5b8fc382b 14 #define MBED_MSTEPMOTOR_H
mdu7078 0:acf5b8fc382b 15
mdu7078 0:acf5b8fc382b 16 #include "mbed.h"
mdu7078 0:acf5b8fc382b 17
mdu7078 0:acf5b8fc382b 18 class mMotor {
mdu7078 0:acf5b8fc382b 19 public:
mdu7078 0:acf5b8fc382b 20
mdu7078 0:acf5b8fc382b 21 mMotor(PinName M0, PinName M1, PinName M2, PinName M3); //motor constructor
mdu7078 0:acf5b8fc382b 22
mdu7078 1:6e0a307d0f9b 23 /* Low Torque mode */
mdu7078 0:acf5b8fc382b 24 void step(int num_steps, int direction, int speed);
mdu7078 0:acf5b8fc382b 25 void counterclockwise();
mdu7078 0:acf5b8fc382b 26 void clockwise();
mdu7078 1:6e0a307d0f9b 27
mdu7078 1:6e0a307d0f9b 28 /* High Torque mode */
mdu7078 1:6e0a307d0f9b 29 void ht_step(int num_steps, int direction, int speed);
mdu7078 1:6e0a307d0f9b 30 void ht_counterclockwise();
mdu7078 1:6e0a307d0f9b 31 void ht_clockwise();
mdu7078 0:acf5b8fc382b 32
mdu7078 0:acf5b8fc382b 33
mdu7078 0:acf5b8fc382b 34 private:
mdu7078 0:acf5b8fc382b 35
mdu7078 0:acf5b8fc382b 36 DigitalOut _M0;
mdu7078 0:acf5b8fc382b 37 DigitalOut _M1;
mdu7078 0:acf5b8fc382b 38 DigitalOut _M2;
mdu7078 0:acf5b8fc382b 39 DigitalOut _M3;
mdu7078 0:acf5b8fc382b 40
mdu7078 0:acf5b8fc382b 41 };
mdu7078 0:acf5b8fc382b 42
mdu7078 0:acf5b8fc382b 43 #endif