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 Robot2016_2-0 by
StepperMotor/Stepper.h@97:42167cfeb8d7, 2016-05-06 (annotated)
- Committer:
- sype
- Date:
- Fri May 06 22:15:43 2016 +0000
- Revision:
- 97:42167cfeb8d7
- Parent:
- 93:c0b040954eac
update gotoDistPos
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| IceTeam | 92:f09f55aa992b | 1 | #ifndef MBED_STEPPER_H |
| IceTeam | 92:f09f55aa992b | 2 | #define MBED_STEPPER_H |
| IceTeam | 92:f09f55aa992b | 3 | |
| IceTeam | 92:f09f55aa992b | 4 | #include "mbed.h" |
| IceTeam | 93:c0b040954eac | 5 | #include "defines_Stepper.h" |
| IceTeam | 92:f09f55aa992b | 6 | |
| IceTeam | 92:f09f55aa992b | 7 | class Stepper |
| IceTeam | 92:f09f55aa992b | 8 | { |
| IceTeam | 92:f09f55aa992b | 9 | public: |
| IceTeam | 92:f09f55aa992b | 10 | Stepper(PinName _en, PinName _stepPin, PinName dir, PinName _minEndStop, float step_per_mm); |
| IceTeam | 92:f09f55aa992b | 11 | bool step(int _number, int _dir, float _speed, bool _async=false); |
| IceTeam | 92:f09f55aa992b | 12 | bool mm(int _number, int _dir, bool _async=false); |
| IceTeam | 92:f09f55aa992b | 13 | bool mm(float _distance, bool _async=false); |
| IceTeam | 92:f09f55aa992b | 14 | |
| IceTeam | 92:f09f55aa992b | 15 | bool done(); |
| IceTeam | 92:f09f55aa992b | 16 | |
| IceTeam | 92:f09f55aa992b | 17 | void enable(); |
| IceTeam | 92:f09f55aa992b | 18 | void disable(); |
| IceTeam | 92:f09f55aa992b | 19 | |
| IceTeam | 92:f09f55aa992b | 20 | int getEndStop() {return minEndStop.read();} |
| IceTeam | 92:f09f55aa992b | 21 | |
| IceTeam | 92:f09f55aa992b | 22 | void tick(); |
| IceTeam | 92:f09f55aa992b | 23 | |
| IceTeam | 92:f09f55aa992b | 24 | float Step_Per_MM; |
| IceTeam | 92:f09f55aa992b | 25 | private: |
| IceTeam | 92:f09f55aa992b | 26 | DigitalOut en; |
| IceTeam | 92:f09f55aa992b | 27 | DigitalOut stepPin; |
| IceTeam | 92:f09f55aa992b | 28 | DigitalOut direction; |
| IceTeam | 92:f09f55aa992b | 29 | DigitalIn minEndStop; |
| IceTeam | 92:f09f55aa992b | 30 | |
| IceTeam | 92:f09f55aa992b | 31 | int number; |
| IceTeam | 92:f09f55aa992b | 32 | int dir; |
| IceTeam | 92:f09f55aa992b | 33 | float speed; |
| IceTeam | 92:f09f55aa992b | 34 | bool async; |
| IceTeam | 92:f09f55aa992b | 35 | Ticker ticker; |
| IceTeam | 92:f09f55aa992b | 36 | |
| IceTeam | 92:f09f55aa992b | 37 | }; |
| IceTeam | 92:f09f55aa992b | 38 | |
| IceTeam | 92:f09f55aa992b | 39 | |
| IceTeam | 92:f09f55aa992b | 40 | #endif |
