test0313
sMotor.h@2:9b9db9c1c097, 2019-10-17 (annotated)
- Committer:
- lpisuseful
- Date:
- Thu Oct 17 07:17:04 2019 +0000
- Revision:
- 2:9b9db9c1c097
- Parent:
- 1:0ea5b11066c5
test1081017
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
XtaticO | 0:4b3b9e047ce3 | 1 | /* |
XtaticO | 0:4b3b9e047ce3 | 2 | ############################################ |
XtaticO | 0:4b3b9e047ce3 | 3 | ## sMotor v0.1 Library ## |
XtaticO | 0:4b3b9e047ce3 | 4 | ## created by Samuel Matildes ## |
XtaticO | 0:4b3b9e047ce3 | 5 | ############################################ |
XtaticO | 0:4b3b9e047ce3 | 6 | ---- sam.naeec@gmail.com ----- |
XtaticO | 0:4b3b9e047ce3 | 7 | This library was made for 4-Phase Stepper Motors |
XtaticO | 0:4b3b9e047ce3 | 8 | I don't take any resposability for the damage caused to your equipment. |
XtaticO | 0:4b3b9e047ce3 | 9 | |
XtaticO | 0:4b3b9e047ce3 | 10 | */ |
XtaticO | 0:4b3b9e047ce3 | 11 | #ifndef MBED_SMOTOR_H |
XtaticO | 0:4b3b9e047ce3 | 12 | #define MBED_SMOTOR_H |
XtaticO | 0:4b3b9e047ce3 | 13 | |
XtaticO | 0:4b3b9e047ce3 | 14 | #include "mbed.h" |
XtaticO | 0:4b3b9e047ce3 | 15 | |
XtaticO | 0:4b3b9e047ce3 | 16 | class sMotor { |
XtaticO | 0:4b3b9e047ce3 | 17 | public: |
XtaticO | 0:4b3b9e047ce3 | 18 | |
XtaticO | 0:4b3b9e047ce3 | 19 | sMotor(PinName A0, PinName A1, PinName A2, PinName A3); //motor constructor |
XtaticO | 0:4b3b9e047ce3 | 20 | |
XtaticO | 0:4b3b9e047ce3 | 21 | void step(int num_steps, int direction, int speed); |
XtaticO | 0:4b3b9e047ce3 | 22 | void anticlockwise(); |
XtaticO | 0:4b3b9e047ce3 | 23 | void clockwise(); |
lpisuseful | 1:0ea5b11066c5 | 24 | void setzerostep(int SetZeroSteps, int direction, int speed); |
lpisuseful | 2:9b9db9c1c097 | 25 | void SetZeroClockWise(); |
lpisuseful | 1:0ea5b11066c5 | 26 | |
XtaticO | 0:4b3b9e047ce3 | 27 | |
XtaticO | 0:4b3b9e047ce3 | 28 | |
XtaticO | 0:4b3b9e047ce3 | 29 | private: |
XtaticO | 0:4b3b9e047ce3 | 30 | |
XtaticO | 0:4b3b9e047ce3 | 31 | DigitalOut _A0; |
XtaticO | 0:4b3b9e047ce3 | 32 | DigitalOut _A1; |
XtaticO | 0:4b3b9e047ce3 | 33 | DigitalOut _A2; |
XtaticO | 0:4b3b9e047ce3 | 34 | DigitalOut _A3; |
lpisuseful | 1:0ea5b11066c5 | 35 | //DigitalIn _D11; |
lpisuseful | 1:0ea5b11066c5 | 36 | //DigitalOut _D12; |
lpisuseful | 1:0ea5b11066c5 | 37 | |
XtaticO | 0:4b3b9e047ce3 | 38 | |
XtaticO | 0:4b3b9e047ce3 | 39 | }; |
XtaticO | 0:4b3b9e047ce3 | 40 | |
XtaticO | 0:4b3b9e047ce3 | 41 | #endif |