
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
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.
Revision 28:3f17a4152bcf, committed 2017-03-01
- Comitter:
- Davidroid
- Date:
- Wed Mar 01 13:32:24 2017 +0000
- Parent:
- 27:a5eab4f20e4e
- Child:
- 29:526970c1d998
- Commit message:
- Fitting mbed coding style.
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 28 13:53:06 2016 +0000 +++ b/X_NUCLEO_IHM01A1.lib Wed Mar 01 13:32:24 2017 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/ST/code/X_NUCLEO_IHM01A1/#c4d0fee5ce75 +https://developer.mbed.org/teams/ST/code/X_NUCLEO_IHM01A1/#6e5198e46287
--- a/main.cpp Fri Oct 28 13:53:06 2016 +0000 +++ b/main.cpp Wed Mar 01 13:32:24 2017 +0000 @@ -85,10 +85,12 @@ /* Initializing Motor Control Components. */ motor1 = new L6474(D2, D8, D7, D9, D10, dev_spi); motor2 = new L6474(D2, D8, D4, D3, D10, dev_spi); - if (motor1->Init() != COMPONENT_OK) + if (motor1->Init() != COMPONENT_OK) { exit(EXIT_FAILURE); - if (motor2->Init() != COMPONENT_OK) + } + if (motor2->Init() != COMPONENT_OK) { exit(EXIT_FAILURE); + } /* Printing to the console. */ printf("Motor Control Application Example for 2 Motors\r\n\n"); @@ -282,8 +284,7 @@ motor2->SetHome(); /* Infinite Loop. */ - while(1) - { + while(true) { /* Requesting to go to a specified position. */ motor1->GoTo(STEPS >> 1); motor2->GoTo(- (STEPS >> 1));