Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EsmacatShield X_NUCLEO_IHM01A1
Revision 27:e09aa231c16d, committed 2016-04-08
- Comitter:
- Davidroid
- Date:
- Fri Apr 08 12:48:30 2016 +0000
- Parent:
- 26:b0203c2265e5
- Child:
- 28:e15fc9311ca3
- Commit message:
- + Added a SetHome() after changing the step mode.; + Updated with the new version of the library.
Changed in this revision
| X_NUCLEO_IHM01A1.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/X_NUCLEO_IHM01A1.lib Thu Apr 07 16:33:42 2016 +0000 +++ b/X_NUCLEO_IHM01A1.lib Fri Apr 08 12:48:30 2016 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/ST/code/X_NUCLEO_IHM01A1/#1c3146315f16 +http://developer.mbed.org/teams/ST/code/X_NUCLEO_IHM01A1/#fd83fecf1ef5
--- 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);