example for easyStepper
Dependencies: mbed easyStepper
main.cpp@0:ee86f47fc2f7, 2018-09-07 (annotated)
- Committer:
- Dennis_Yu
- Date:
- Fri Sep 07 14:09:40 2018 +0000
- Revision:
- 0:ee86f47fc2f7
example for easyStepper
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Dennis_Yu | 0:ee86f47fc2f7 | 1 | #include "mbed.h" |
Dennis_Yu | 0:ee86f47fc2f7 | 2 | #include "stepper.h" |
Dennis_Yu | 0:ee86f47fc2f7 | 3 | |
Dennis_Yu | 0:ee86f47fc2f7 | 4 | DigitalOut myled(LED1); |
Dennis_Yu | 0:ee86f47fc2f7 | 5 | |
Dennis_Yu | 0:ee86f47fc2f7 | 6 | Stepper myStepper[2] = |
Dennis_Yu | 0:ee86f47fc2f7 | 7 | { |
Dennis_Yu | 0:ee86f47fc2f7 | 8 | {PC_5, PC_4, PD_2}, |
Dennis_Yu | 0:ee86f47fc2f7 | 9 | {PA_5, PA_4, PA_2}, |
Dennis_Yu | 0:ee86f47fc2f7 | 10 | }; |
Dennis_Yu | 0:ee86f47fc2f7 | 11 | |
Dennis_Yu | 0:ee86f47fc2f7 | 12 | int main() { |
Dennis_Yu | 0:ee86f47fc2f7 | 13 | while(1) |
Dennis_Yu | 0:ee86f47fc2f7 | 14 | { |
Dennis_Yu | 0:ee86f47fc2f7 | 15 | rotate(myStepper[0], 0.0002, 1000); |
Dennis_Yu | 0:ee86f47fc2f7 | 16 | rotate(myStepper[0], 0.0002, -1000); |
Dennis_Yu | 0:ee86f47fc2f7 | 17 | rotate(myStepper[1], 0.0002, 1000); |
Dennis_Yu | 0:ee86f47fc2f7 | 18 | rotate(myStepper[1], 0.0002, -1000); |
Dennis_Yu | 0:ee86f47fc2f7 | 19 | } |
Dennis_Yu | 0:ee86f47fc2f7 | 20 | } |