A simple stepper motor driver library, supporting micro-stepping drivers such as the Pololu A4988 stepper driver carrier or the Sparkfun EasyDriver.
Fork of StepperMotor by
Diff: Stepper.h
- Revision:
- 1:6fbe104c6f37
- Parent:
- 0:52fb09e87581
--- a/Stepper.h Sun Feb 24 16:23:02 2013 +0000 +++ b/Stepper.h Thu Nov 03 17:14:37 2016 +0000 @@ -3,17 +3,19 @@ #endif #include "mbed.h" +#define MAX_ACCEL 500 -class stepper -{ +class stepper{ public: - stepper(PinName _en, PinName ms1, PinName ms2, PinName ms3, PinName _stepPin, PinName dir); - void step(int microstep, int dir, float speed); + stepper(PinName _en, PinName _stepPin, PinName dir); + void step(float speed); void enable(); void disable(); + void toggle_step(); private: + float actualSpeed; DigitalOut en; - BusOut microstepping; DigitalOut stepPin; DigitalOut direction; + Ticker toggler; }; \ No newline at end of file