Simple test application for the STMicroelectronics X-NUCLEO-IHM01A1 Stepper Motor Control Expansion Board.
Dependencies: X_NUCLEO_IHM01A1 mbed
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.
Diff: main.cpp
- Revision:
- 28:3f17a4152bcf
- Parent:
- 24:8cb3c4ad055f
- Child:
- 29:526970c1d998
diff -r a5eab4f20e4e -r 3f17a4152bcf main.cpp --- 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));