tim004 tim004
/
pripremaLV9
priprema LV9 Z02 Sumejja Porca
Revision 1:37330eb60af3, committed 2014-05-12
- Comitter:
- tim004
- Date:
- Mon May 12 11:10:52 2014 +0000
- Parent:
- 0:51ca78452cb5
- Commit message:
- priprema LV9 Z02 Sumejja Porca
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 51ca78452cb5 -r 37330eb60af3 main.cpp --- a/main.cpp Mon May 12 11:05:55 2014 +0000 +++ b/main.cpp Mon May 12 11:10:52 2014 +0000 @@ -27,13 +27,13 @@ { if(on) { - double angle; - printf("Specify the angle: \n\r"); + int angle; + printf("Specify the angle to move the motor from current position: \n\r"); pc.scanf("%d", &angle); if ( angle > 0 ) - motor.step(numstep / 360.0 * (angle - (angle/360.0 * 360.0)), direction, step_speed); // number of steps, direction, speed + motor.step(numstep / 360.0 * (angle % 360), direction, step_speed); // number of steps, direction, speed else - motor.step(numstep / 360.0 * (angle - (angle/360.0 * 360.0)), 1 - direction, step_speed); // number of steps, direction, speed + motor.step(numstep / 360.0 * (angle % 360), 1 - direction, step_speed); // number of steps, direction, speed } else printf("The motor is off. Turn it on first. \n\r");