![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
3-26-2015 DSV
Fork of R5_StepperDrive by
StepperDrive.h
- Committer:
- jmar11
- Date:
- 2015-11-22
- Revision:
- 0:266a770a17e9
- Child:
- 1:909572175aad
File content as of revision 0:266a770a17e9:
#ifndef _STEPPER_DRIVE_ #define _STEPPER_DRIVE_ #include "mbed.h" #define Ustep 16 //microstepping setup: 1, 2, 4, 8, or 16 class StepperDrive{ public: StepperDrive(PinName in1, PinName in2, bool in3, PinName in4, PinName in5, bool in6, float in7, float in8, float in9 = 1000); //(stepPinLeft, dirPinLeft, invertLeft, stepPinRight, dirPinRight, invertRight, wheelCircum, wheelSepar, periodUs) int move(float distance, float angle); bool isMoveDone(); private: Ticker pit; //periodic interrupt timer void pitCallback(); void stepRight(bool dir); void stepLeft(bool dir); DigitalOut leftStep; DigitalOut leftDir; DigitalOut rightStep; DigitalOut rightDir; float wheelCircum; //wheel circumference float wheelSepar; //distance between wheels bool invertLeft; //software wheel direction inversion bool invertRight; //software wheel direction inversion bool moveComplete; int leftSteps; int rightSteps; float leftStepsPC; float rightStepsPC; float leftError; float rightError; }; #endif