![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
teste 1 motor para Bruno
Dependencies: X_NUCLEO_IHM01A1 mbed
Fork of HelloWorld_IHM01A1 by
Diff: main.cpp
- Revision:
- 27:e09aa231c16d
- Parent:
- 26:b0203c2265e5
- Child:
- 29:a80a213c3c94
--- a/main.cpp Thu Apr 07 16:33:42 2016 +0000 +++ b/main.cpp Fri Apr 08 12:48:30 2016 +0000 @@ -175,21 +175,36 @@ /*----- Changing the motor setting. -----*/ /* Printing to the console. */ + printf("--> Setting Torque Regulation Current to 500[mA].\r\n"); + + /* Increasing the torque regulation current to 500[mA]. */ + motor->SetParameter(L6474_TVAL, 500); + + /* Printing to the console. */ printf("--> Doubling the microsteps.\r\n"); /* Doubling the microsteps. */ if (!motor->SetStepMode((StepperMotor::step_mode_t) STEP_MODE_1_16)) printf(" Step Mode not allowed.\r\n"); - /* Printing to the console. */ - printf("--> Setting Torque Regulation Current to 500[mA].\r\n"); - - /* Increasing the torque regulation current to 500[mA]. */ - motor->SetParameter(L6474_TVAL, 500); - /* Waiting. */ wait_ms(DELAY_1); + /* Printing to the console. */ + printf("--> Setting Home.\r\n"); + + /* Setting the current position to be the home position. */ + motor->SetHome(); + + /* Getting current position. */ + position = motor->GetPosition(); + + /* Printing to the console. */ + printf(" Position: %d.\r\n", position); + + /* Waiting. */ + wait_ms(DELAY_2); + /*----- Moving. -----*/ @@ -207,10 +222,6 @@ /* Printing to the console. */ printf(" Position: %d.\r\n", position); - printf("--> Setting Home.\r\n"); - - /* Setting the current position to be the home position. */ - motor->SetHome(); /* Waiting. */ wait_ms(DELAY_1);