Simple test application for the STMicroelectronics X-NUCLEO-IHM01A1 Stepper Motor Control Expansion Board, built against mbed OS.

Dependencies:   X_NUCLEO_IHM01A1

Fork of HelloWorld_IHM01A1_2Motors by ST

Motor Control with the X-NUCLEO-IHM01A1 Expansion Board

This application provides a simple example of usage of the X-NUCLEO-IHM01A1 Stepper Motor Control Expansion Board.
It shows how to use two stepper motors connected to two stacked boards in daisy chain configuration, moving the rotors to specific positions, with given speed values, directions of rotation, etc.

Files at this revision

API Documentation at this revision

Comitter:
Davidroid
Date:
Fri Nov 13 12:59:29 2015 +0000
Parent:
1:fbf28f3367aa
Child:
3:02d9ec4f88b2
Commit message:
Adaptation to the "StepperMotor" abstract class.

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	Fri Oct 16 13:51:31 2015 +0000
+++ b/X_NUCLEO_IHM01A1.lib	Fri Nov 13 12:59:29 2015 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/ST-Expansion-SW-Team/code/X_NUCLEO_IHM01A1/#b38ebb8ea286
+https://developer.mbed.org/teams/ST-Expansion-SW-Team/code/X_NUCLEO_IHM01A1/#83a1eb397a65
--- a/main.cpp	Fri Oct 16 13:51:31 2015 +0000
+++ b/main.cpp	Fri Nov 13 12:59:29 2015 +0000
@@ -87,7 +87,7 @@
         printf("--> Moving forward %d steps.\r\n", ROUND_ANGLE_STEPS);
 
         /* Moving N steps in the forward direction. */
-        motor->Move(FORWARD, ROUND_ANGLE_STEPS);
+        motor->Move(StepperMotor::CW, ROUND_ANGLE_STEPS);
         
         /* Waiting while the motor is active. */
         motor->WaitWhileActive();
@@ -108,7 +108,7 @@
         printf("--> Moving backward %d steps.\r\n", ROUND_ANGLE_STEPS);
         
         /* Moving N steps in the backward direction. */
-        motor->Move(BACKWARD, ROUND_ANGLE_STEPS);
+        motor->Move(StepperMotor::CCW, ROUND_ANGLE_STEPS);
         
         /* Waiting while the motor is active. */
         motor->WaitWhileActive();
@@ -174,13 +174,13 @@
         printf("--> Moving backward.\r\n");
 
         /* Requesting to run backward. */
-        motor->Run(BACKWARD);
+        motor->Run(StepperMotor::CCW);
 
         /* Waiting until delay has expired. */
         wait_ms(6000);
 
         /* Getting current speed. */
-        int speed = motor->GetCurrentSpeed();
+        int speed = motor->GetSpeed();
 
         /* Printing to the console. */
         printf("    Speed: %d.\r\n", speed);
@@ -198,7 +198,7 @@
         wait_ms(6000);
 
         /* Getting current speed. */
-        speed = motor->GetCurrentSpeed();
+        speed = motor->GetSpeed();
 
         /* Printing to the console. */
         printf("    Speed: %d.\r\n", speed);
@@ -216,7 +216,7 @@
         wait_ms(8000);
 
         /* Getting current speed. */
-        speed = motor->GetCurrentSpeed();
+        speed = motor->GetSpeed();
 
         /* Printing to the console. */
         printf("    Speed: %d.\r\n", speed);
@@ -228,7 +228,7 @@
         printf("--> Moving forward.\r\n");
 
         /* Requesting to run in forward direction. */
-        motor->Run(FORWARD);
+        motor->Run(StepperMotor::CW);
 
         /* Waiting until delay has expired. */
         wait_ms(4000);