Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Timer by
Diff: StepperMotor/Stepper.h
- Revision:
- 71:5590dbe8393a
- Parent:
- 58:02dc8328975a
--- a/StepperMotor/Stepper.h Wed May 04 21:51:00 2016 +0000
+++ b/StepperMotor/Stepper.h Thu May 05 03:47:05 2016 +0000
@@ -7,20 +7,32 @@
{
public:
Stepper(PinName _en, PinName _stepPin, PinName dir, PinName _minEndStop, float step_per_mm);
- void step(int number, int dir, float speed);
- void mm(int number, int dir);
- void mm(float distance);
+ bool step(int _number, int _dir, float _speed, bool _async=false);
+ bool mm(int _number, int _dir, bool _async=false);
+ bool mm(float _distance, bool _async=false);
+
+ bool done();
+
void enable();
void disable();
int getEndStop() {return minEndStop.read();}
+ void tick();
+
float Step_Per_MM;
private:
DigitalOut en;
DigitalOut stepPin;
DigitalOut direction;
DigitalIn minEndStop;
+
+ int number;
+ int dir;
+ float speed;
+ bool async;
+ Ticker ticker;
+
};
