Updated stepper motor controller
Fork of StepperController by
steppercontroller.h
- Committer:
- acracan
- Date:
- 2018-06-08
- Revision:
- 1:6e8186dd5bfa
- Parent:
- 0:2cfd64d210f3
File content as of revision 1:6e8186dd5bfa:
#ifndef STEPPERCONTROLLER_H #define STEPPERCONTROLLER_H #include "mbed.h" class StepperController { public: enum Direction {DirectionCW = 1, DirectionCCW = -1}; enum SequenceType {Consecutive, Interleaved}; StepperController(PinName phaseA,PinName enA, PinName phaseB, PinName enB ); void advance(); void setPeriod(float period); void setPulseWidth(float width); void setDirection(Direction dir); void setSequenceType(SequenceType seq); private: int state; float pulseWidth; DigitalOut phaseA, phaseB; PwmOut enA, enB; Direction dir; SequenceType seq; void updateOutputs(); }; #endif