![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
programma motori
Dependencies: X_NUCLEO_IHM01A1 mbed
Fork of HelloWorld_IHM01A1_2Motors by
Revision 28:3f17a4152bcf, committed 2017-03-01
- Comitter:
- Davidroid
- Date:
- Wed Mar 01 13:32:24 2017 +0000
- Parent:
- 27:a5eab4f20e4e
- 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 |
diff -r a5eab4f20e4e -r 3f17a4152bcf X_NUCLEO_IHM01A1.lib --- 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
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));