Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: X_NUCLEO_IHM01A1 mbed
Fork of HelloWorld_IHM01A1_2Motors by
Diff: main.cpp
- Revision:
- 28:3f17a4152bcf
- Parent:
- 24:8cb3c4ad055f
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));
