Program for stepper test.
Dependencies: StepperDriver mbed
main.cpp@0:98715b9719a6, 2016-12-01 (annotated)
- Committer:
- tbjazic
- Date:
- Thu Dec 01 13:40:19 2016 +0000
- Revision:
- 0:98715b9719a6
- Child:
- 1:5d11b66aba85
Initial commit.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tbjazic | 0:98715b9719a6 | 1 | #include "mbed.h" |
tbjazic | 0:98715b9719a6 | 2 | #include "StepperDriver.h" |
tbjazic | 0:98715b9719a6 | 3 | |
tbjazic | 0:98715b9719a6 | 4 | StepperDriver stepper(p26, p29); |
tbjazic | 0:98715b9719a6 | 5 | float t = 0; |
tbjazic | 0:98715b9719a6 | 6 | |
tbjazic | 0:98715b9719a6 | 7 | int main() { |
tbjazic | 0:98715b9719a6 | 8 | stepper.setPosition(322); |
tbjazic | 0:98715b9719a6 | 9 | wait(2); |
tbjazic | 0:98715b9719a6 | 10 | while(true) { |
tbjazic | 0:98715b9719a6 | 11 | stepper.setPosition(322+175*sin(2*3.14159*1*t)); |
tbjazic | 0:98715b9719a6 | 12 | t += 0.05; |
tbjazic | 0:98715b9719a6 | 13 | wait(0.05); |
tbjazic | 0:98715b9719a6 | 14 | } |
tbjazic | 0:98715b9719a6 | 15 | } |