-
Dependencies: X_NUCLEO_IHM01A1 mbed
Fork of joy_buttons_versao_2 by
Diff: main.cpp
- Revision:
- 10:8f031470ca9f
- Parent:
- 9:dc704c11181d
- Child:
- 11:3e303a25770d
diff -r dc704c11181d -r 8f031470ca9f main.cpp --- a/main.cpp Fri Nov 27 10:02:40 2015 +0000 +++ b/main.cpp Fri Nov 27 11:26:14 2015 +0000 @@ -51,8 +51,8 @@ /* Definitions ---------------------------------------------------------------*/ -/* Number of steps corresponding to one round angle of the motor. */ -#define MOTOR_STEPS 400 +/* Number of steps to move. */ +#define STEPS 3200 /* Variables -----------------------------------------------------------------*/ @@ -82,10 +82,10 @@ /*----- Moving. -----*/ /* Printing to the console. */ - printf("--> Moving forward %d steps.\r\n", MOTOR_STEPS); + printf("--> Moving forward %d steps.\r\n", STEPS); /* Moving N steps in the forward direction. */ - motor->Move(StepperMotor::FWD, MOTOR_STEPS); + motor->Move(StepperMotor::FWD, STEPS); /* Waiting while the motor is active. */ motor->WaitWhileActive(); @@ -103,10 +103,10 @@ /*----- Moving. -----*/ /* Printing to the console. */ - printf("--> Moving backward %d steps.\r\n", MOTOR_STEPS >> 1); + printf("--> Moving backward %d steps.\r\n", STEPS >> 1); /* Moving N steps in the backward direction. */ - motor->Move(StepperMotor::BWD, MOTOR_STEPS >> 1); + motor->Move(StepperMotor::BWD, STEPS >> 1); /* Waiting while the motor is active. */ motor->WaitWhileActive(); @@ -128,10 +128,10 @@ /*----- Going to a specified position. -----*/ /* Printing to the console. */ - printf("--> Going to position %d.\r\n", MOTOR_STEPS >> 1); + printf("--> Going to position %d.\r\n", STEPS >> 1); /* Requesting to go to a specified position. */ - motor->GoTo(MOTOR_STEPS >> 1); + motor->GoTo(STEPS >> 1); /* Waiting while the motor is active. */ motor->WaitWhileActive(); @@ -247,13 +247,13 @@ while (1) { /* Requesting to go to a specified position. */ - motor->GoTo(MOTOR_STEPS >> 1); + motor->GoTo(STEPS >> 1); /* Waiting while the motor is active. */ motor->WaitWhileActive(); /* Requesting to go to a specified position. */ - motor->GoTo(- (MOTOR_STEPS >> 1)); + motor->GoTo(- (STEPS >> 1)); /* Waiting while the motor is active. */ motor->WaitWhileActive();