A simple stepper motor driver library, supporting micro-stepping drivers such as the Pololu A4988 stepper driver carrier or the Sparkfun EasyDriver.
Dependents: Robot2016_2-0_STATIC Robot2016_2-0
Fork of StepperMotor by
Stepper.h@3:c7011e72f0c7, 2016-05-04 (annotated)
- Committer:
- sype
- Date:
- Wed May 04 16:14:30 2016 +0000
- Revision:
- 3:c7011e72f0c7
- Parent:
- 2:1cec7e9117f2
Revision, impl?mentation d?placement en mm
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
melse | 0:52fb09e87581 | 1 | #ifndef MBED_STEPPER_H |
melse | 0:52fb09e87581 | 2 | #define MBED_STEPPER_H |
melse | 0:52fb09e87581 | 3 | #endif |
melse | 0:52fb09e87581 | 4 | |
melse | 0:52fb09e87581 | 5 | #include "mbed.h" |
sype | 2:1cec7e9117f2 | 6 | #define DELAY 0.007 |
melse | 0:52fb09e87581 | 7 | |
sype | 1:e34729a7567f | 8 | class Stepper |
melse | 0:52fb09e87581 | 9 | { |
melse | 0:52fb09e87581 | 10 | public: |
sype | 3:c7011e72f0c7 | 11 | Stepper(PinName _en, PinName _stepPin, PinName dir, float step_per_mm); |
sype | 1:e34729a7567f | 12 | void step(int number, int dir, float speed); |
sype | 3:c7011e72f0c7 | 13 | void mm(int number, int dir); |
melse | 0:52fb09e87581 | 14 | void enable(); |
melse | 0:52fb09e87581 | 15 | void disable(); |
sype | 3:c7011e72f0c7 | 16 | |
sype | 3:c7011e72f0c7 | 17 | float Step_Per_MM; |
melse | 0:52fb09e87581 | 18 | private: |
melse | 0:52fb09e87581 | 19 | DigitalOut en; |
melse | 0:52fb09e87581 | 20 | DigitalOut stepPin; |
melse | 0:52fb09e87581 | 21 | DigitalOut direction; |
melse | 0:52fb09e87581 | 22 | }; |