Simple program featuring a few API functions usage of the X_NUCLEO_IHM06A1 library.
Dependencies: X_NUCLEO_IHM06A1 mbed
Fork of HelloWorld_IHM06A1 by
This application provides a simple example of usage of the X-NUCLEO-IHM06A1 Bipolar Stepper Motor Control Expansion Board.
It shows how to use a stepper motor connected to the board by:
- Running the motor;
- Monitoring the speed and the motor state;
- Setting/Getting the speed;
- Setting/Getting the step mode;
- Setting/Getting the acceleration and deceleration;
- Moving a defined number of steps or microsteps;
- Disabling the power bridges;
- Setting/Getting the torque;
- Going to home position
It also shows how to monitor the step clock handler duration in order to evaluate the maximum achievable motor speed for a given MCU.
For the hardware configuration of the expansion board, please refer to the X_NUCLEO_IHM06A1 library web page.
Revision 5:8c0802d9a345, committed 2017-03-24
- Comitter:
- Davidroid
- Date:
- Fri Mar 24 13:54:58 2017 +0000
- Parent:
- 4:0e50964ff610
- Child:
- 6:a67d7d9f5528
- Commit message:
- With the new version of the library.
Changed in this revision
| X-NUCLEO-IHM06A1.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-IHM06A1.lib Fri Mar 24 11:00:53 2017 +0100 +++ b/X-NUCLEO-IHM06A1.lib Fri Mar 24 13:54:58 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/ST/code/X_NUCLEO_IHM06A1/#2ba230b24f25 +https://developer.mbed.org/teams/ST/code/X_NUCLEO_IHM06A1/#265c30b9112a
--- a/main.cpp Fri Mar 24 11:00:53 2017 +0100
+++ b/main.cpp Fri Mar 24 13:54:58 2017 +0000
@@ -59,7 +59,7 @@
/* Variables -----------------------------------------------------------------*/
/* Initialization parameters of the motor connected to the expansion board. */
-Stspin220_init_t init =
+STSpin220_init_t init =
{
10000, //Acceleration rate in pulse/s2 (must be greater than 0)
10000, //Deceleration rate in pulse/s2 (must be greater than 0)
@@ -94,7 +94,7 @@
void my_flag_irq_handler(void)
{
printf(" WARNING: \"FLAG\" interrupt triggered:\r\n");
- motor->Disable();
+ motor->disable();
printf(" Motor disabled.\r\n\n");
}
@@ -238,7 +238,7 @@
printf(" Position: %d.\r\n", motor->get_position());
/* Disable the power bridges */
- motor->Disable();
+ motor->disable();
/* Check that the power bridges are actually disabled */
if (motor->check_status_hw()!=0) {

X-NUCLEO-IHM06A1 Low Voltage Stepper Motor Driver