A fork of a fine man's work. simplified. No microstepping etc, just a work in progress

Fork of BipoarStepperMotor by Harsha vardan

Committer:
InBrewJ
Date:
Tue Feb 03 03:44:45 2015 +0000
Revision:
6:84c5df74391b
changed the names to "lsMotor.h" etc - for "Linear Stepper Motor"

Who changed what in which revision?

UserRevisionLine numberNew contents of line
InBrewJ 6:84c5df74391b 1 /*
InBrewJ 6:84c5df74391b 2 ##############################################
InBrewJ 6:84c5df74391b 3 ##Original Program Created by Harshavardan61##
InBrewJ 6:84c5df74391b 4 ##############################################
InBrewJ 6:84c5df74391b 5 ---- harshavardan61@gmail.com -----
InBrewJ 6:84c5df74391b 6 Extended by Jason Brewer 2015
InBrewJ 6:84c5df74391b 7 to adapt to the stepper motor + linear actuator
InBrewJ 6:84c5df74391b 8 supplied by Selim Yilmaz
InBrewJ 6:84c5df74391b 9
InBrewJ 6:84c5df74391b 10 Now includes functional stepper pulses, a motor enable pin
InBrewJ 6:84c5df74391b 11 (motor and l293D were getting very warm if the enable pin was
InBrewJ 6:84c5df74391b 12 always HIGH)
InBrewJ 6:84c5df74391b 13
InBrewJ 6:84c5df74391b 14 */
InBrewJ 6:84c5df74391b 15 #ifndef MBED_LSMOTOR_H
InBrewJ 6:84c5df74391b 16 #define MBED_LSMOTOR_H
InBrewJ 6:84c5df74391b 17
InBrewJ 6:84c5df74391b 18 #include "mbed.h"
InBrewJ 6:84c5df74391b 19
InBrewJ 6:84c5df74391b 20 class lsMotor {
InBrewJ 6:84c5df74391b 21 public:
InBrewJ 6:84c5df74391b 22
InBrewJ 6:84c5df74391b 23 lsMotor(PinName A0, PinName A1, PinName A2, PinName A3, PinName motorEnable, const int maxSteps); //motor constructor
InBrewJ 6:84c5df74391b 24
InBrewJ 6:84c5df74391b 25 void setMotorPosition(int position); // for use ONLY if the stepper init is skipped
InBrewJ 6:84c5df74391b 26 int getMotorPosition(void){ return _motorPosition; };
InBrewJ 6:84c5df74391b 27 void step(int num_steps, int direction, int speed);
InBrewJ 6:84c5df74391b 28 void up(int num_steps);
InBrewJ 6:84c5df74391b 29 void down(int num_steps);
InBrewJ 6:84c5df74391b 30
InBrewJ 6:84c5df74391b 31
InBrewJ 6:84c5df74391b 32 private:
InBrewJ 6:84c5df74391b 33
InBrewJ 6:84c5df74391b 34 DigitalOut _A0;
InBrewJ 6:84c5df74391b 35 DigitalOut _A1;
InBrewJ 6:84c5df74391b 36 DigitalOut _A2;
InBrewJ 6:84c5df74391b 37 DigitalOut _A3;
InBrewJ 6:84c5df74391b 38 DigitalOut _motorEnable;
InBrewJ 6:84c5df74391b 39 int _motorPosition;
InBrewJ 6:84c5df74391b 40 int _maxSteps;
InBrewJ 6:84c5df74391b 41 int _motorSpeed;
InBrewJ 6:84c5df74391b 42
InBrewJ 6:84c5df74391b 43 };
InBrewJ 6:84c5df74391b 44
InBrewJ 6:84c5df74391b 45 #endif