Simple test application for the STMicroelectronics X-NUCLEO-IHM02A1 Stepper Motor Control Expansion Board.

Dependencies:   X_NUCLEO_IHM02A1 mbed

Fork of HelloWorld_IHM02A1 by ST Expansion SW Team

Motor Control with the X-NUCLEO-IHM02A1 Expansion Board

This application provides a simple example of usage of the X-NUCLEO-IHM02A1 Stepper Motor Control Expansion Board.
It shows how to use two stepper motors connected in daisy chain configuration to the board, moving the rotors to specific positions, with given speed values, direction of rotations, etc.

Committer:
Davidroid
Date:
Thu Nov 26 16:24:52 2015 +0000
Revision:
2:41eeee48951b
Parent:
1:9f1974b0960d
Child:
3:fd280b953f77
+ Updated with the new version of the X_NUCLEO_IHM02A1 library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Davidroid 0:5148e9486cf2 1 /**
Davidroid 0:5148e9486cf2 2 ******************************************************************************
Davidroid 0:5148e9486cf2 3 * @file main.cpp
Davidroid 2:41eeee48951b 4 * @author Davide Aliprandi, STMicrolectronics
Davidroid 0:5148e9486cf2 5 * @version V1.0.0
Davidroid 0:5148e9486cf2 6 * @date November 4th, 2015
Davidroid 1:9f1974b0960d 7 * @brief mbed test application for the STMicrolectronics X-NUCLEO-IHM02A1
Davidroid 1:9f1974b0960d 8 * Motor Control Expansion Board: control of 2 motors.
Davidroid 0:5148e9486cf2 9 ******************************************************************************
Davidroid 0:5148e9486cf2 10 * @attention
Davidroid 0:5148e9486cf2 11 *
Davidroid 0:5148e9486cf2 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Davidroid 0:5148e9486cf2 13 *
Davidroid 0:5148e9486cf2 14 * Redistribution and use in source and binary forms, with or without modification,
Davidroid 0:5148e9486cf2 15 * are permitted provided that the following conditions are met:
Davidroid 0:5148e9486cf2 16 * 1. Redistributions of source code must retain the above copyright notice,
Davidroid 0:5148e9486cf2 17 * this list of conditions and the following disclaimer.
Davidroid 0:5148e9486cf2 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
Davidroid 0:5148e9486cf2 19 * this list of conditions and the following disclaimer in the documentation
Davidroid 0:5148e9486cf2 20 * and/or other materials provided with the distribution.
Davidroid 0:5148e9486cf2 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Davidroid 0:5148e9486cf2 22 * may be used to endorse or promote products derived from this software
Davidroid 0:5148e9486cf2 23 * without specific prior written permission.
Davidroid 0:5148e9486cf2 24 *
Davidroid 0:5148e9486cf2 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Davidroid 0:5148e9486cf2 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Davidroid 0:5148e9486cf2 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Davidroid 0:5148e9486cf2 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Davidroid 0:5148e9486cf2 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Davidroid 0:5148e9486cf2 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Davidroid 0:5148e9486cf2 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Davidroid 0:5148e9486cf2 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Davidroid 0:5148e9486cf2 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Davidroid 0:5148e9486cf2 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Davidroid 0:5148e9486cf2 35 *
Davidroid 0:5148e9486cf2 36 ******************************************************************************
Davidroid 0:5148e9486cf2 37 */
Davidroid 0:5148e9486cf2 38
Davidroid 0:5148e9486cf2 39
Davidroid 0:5148e9486cf2 40 /* Includes ------------------------------------------------------------------*/
Davidroid 0:5148e9486cf2 41
Davidroid 0:5148e9486cf2 42 /* mbed specific header files. */
Davidroid 0:5148e9486cf2 43 #include "mbed.h"
Davidroid 0:5148e9486cf2 44
Davidroid 0:5148e9486cf2 45 /* Helper header files. */
Davidroid 0:5148e9486cf2 46 #include "DevSPI.h"
Davidroid 0:5148e9486cf2 47
Davidroid 0:5148e9486cf2 48 /* Expansion Board specific header files. */
Davidroid 0:5148e9486cf2 49 #include "x_nucleo_ihm02a1_class.h"
Davidroid 0:5148e9486cf2 50
Davidroid 0:5148e9486cf2 51
Davidroid 0:5148e9486cf2 52 /* Definitions ---------------------------------------------------------------*/
Davidroid 0:5148e9486cf2 53
Davidroid 0:5148e9486cf2 54 /* Number of movements per revolution. */
Davidroid 0:5148e9486cf2 55 #define MPR_1 4
Davidroid 1:9f1974b0960d 56
Davidroid 1:9f1974b0960d 57 /* Number of steps. */
Davidroid 1:9f1974b0960d 58 #define STEPS_1 100000
Davidroid 1:9f1974b0960d 59 #define STEPS_2 200000
Davidroid 0:5148e9486cf2 60
Davidroid 0:5148e9486cf2 61 /* Delay in milliseconds. */
Davidroid 1:9f1974b0960d 62 #define DELAY_1 1000
Davidroid 0:5148e9486cf2 63 #define DELAY_2 2000
Davidroid 0:5148e9486cf2 64 #define DELAY_3 5000
Davidroid 0:5148e9486cf2 65
Davidroid 0:5148e9486cf2 66
Davidroid 0:5148e9486cf2 67 /* Variables -----------------------------------------------------------------*/
Davidroid 0:5148e9486cf2 68
Davidroid 0:5148e9486cf2 69 /* Motor Control Expansion Board. */
Davidroid 0:5148e9486cf2 70 X_NUCLEO_IHM02A1 *x_nucleo_ihm02a1;
Davidroid 0:5148e9486cf2 71
Davidroid 0:5148e9486cf2 72
Davidroid 0:5148e9486cf2 73 /* Main ----------------------------------------------------------------------*/
Davidroid 0:5148e9486cf2 74
Davidroid 0:5148e9486cf2 75 int main()
Davidroid 0:5148e9486cf2 76 {
Davidroid 1:9f1974b0960d 77 /*----- Initialization. -----*/
Davidroid 1:9f1974b0960d 78
Davidroid 2:41eeee48951b 79 /* Initializing SPI bus. */
Davidroid 2:41eeee48951b 80 DevSPI dev_spi(D11, D12, D13);
Davidroid 0:5148e9486cf2 81
Davidroid 2:41eeee48951b 82 /* Initializing Motor Control Expansion Board.
Davidroid 2:41eeee48951b 83
Davidroid 2:41eeee48951b 84 You can stack up to 4 expansion boards together, each one controlling
Davidroid 2:41eeee48951b 85 two stepper motors in daisy-chain configuration, so that motors will
Davidroid 2:41eeee48951b 86 be in daisy-chain configuration two-by-two.
Davidroid 0:5148e9486cf2 87
Davidroid 2:41eeee48951b 88 Concerning the SSEL pin of SPI communication, expansion boards must
Davidroid 2:41eeee48951b 89 be in one of the following configurations:
Davidroid 2:41eeee48951b 90 + SB_23 resistor connected only --> SSEL on pin A2;
Davidroid 2:41eeee48951b 91 + SB_7 resistor connected only --> SSEL on pin D2;
Davidroid 2:41eeee48951b 92 + SB_8 resistor connected only --> SSEL on pin D10;
Davidroid 2:41eeee48951b 93 + SB_9 resistor connected only --> SSEL on pin D5.
Davidroid 2:41eeee48951b 94 */
Davidroid 2:41eeee48951b 95 x_nucleo_ihm02a1 = new X_NUCLEO_IHM02A1(A4, A5, D4, A2, &dev_spi);
Davidroid 0:5148e9486cf2 96
Davidroid 1:9f1974b0960d 97 /* Building a list of motor control components. */
Davidroid 1:9f1974b0960d 98 L6470 **motors = x_nucleo_ihm02a1->GetComponents();
Davidroid 0:5148e9486cf2 99
Davidroid 0:5148e9486cf2 100 /* Printing to the console. */
Davidroid 0:5148e9486cf2 101 printf("Motor Control Application Example for 2 Motors\r\n\n");
Davidroid 0:5148e9486cf2 102
Davidroid 1:9f1974b0960d 103
Davidroid 1:9f1974b0960d 104 /*----- Setting home and marke positions, getting positions, and going to positions. -----*/
Davidroid 1:9f1974b0960d 105
Davidroid 1:9f1974b0960d 106 /* Printing to the console. */
Davidroid 1:9f1974b0960d 107 printf("--> Setting home position.\r\n");
Davidroid 1:9f1974b0960d 108
Davidroid 1:9f1974b0960d 109 /* Setting the home position. */
Davidroid 1:9f1974b0960d 110 motors[0]->SetHome();
Davidroid 1:9f1974b0960d 111
Davidroid 1:9f1974b0960d 112 /* Waiting. */
Davidroid 1:9f1974b0960d 113 wait_ms(DELAY_1);
Davidroid 0:5148e9486cf2 114
Davidroid 1:9f1974b0960d 115 /* Getting the current position. */
Davidroid 1:9f1974b0960d 116 int position = motors[0]->GetPosition();
Davidroid 1:9f1974b0960d 117
Davidroid 1:9f1974b0960d 118 /* Printing to the console. */
Davidroid 1:9f1974b0960d 119 printf("--> Getting the current position: %d\r\n", position);
Davidroid 1:9f1974b0960d 120
Davidroid 1:9f1974b0960d 121 /* Waiting. */
Davidroid 1:9f1974b0960d 122 wait_ms(DELAY_1);
Davidroid 1:9f1974b0960d 123
Davidroid 1:9f1974b0960d 124 /* Printing to the console. */
Davidroid 1:9f1974b0960d 125 printf("--> Moving forward %d steps.\r\n", STEPS_1);
Davidroid 1:9f1974b0960d 126
Davidroid 1:9f1974b0960d 127 /* Moving. */
Davidroid 1:9f1974b0960d 128 motors[0]->Move(StepperMotor::FWD, STEPS_1);
Davidroid 0:5148e9486cf2 129
Davidroid 1:9f1974b0960d 130 /* Waiting while active. */
Davidroid 1:9f1974b0960d 131 motors[0]->WaitWhileActive();
Davidroid 1:9f1974b0960d 132
Davidroid 1:9f1974b0960d 133 /* Getting the current position. */
Davidroid 1:9f1974b0960d 134 position = motors[0]->GetPosition();
Davidroid 1:9f1974b0960d 135
Davidroid 1:9f1974b0960d 136 /* Printing to the console. */
Davidroid 1:9f1974b0960d 137 printf("--> Getting the current position: %d\r\n", position);
Davidroid 1:9f1974b0960d 138
Davidroid 1:9f1974b0960d 139 /* Printing to the console. */
Davidroid 1:9f1974b0960d 140 printf("--> Marking the current position.\r\n");
Davidroid 0:5148e9486cf2 141
Davidroid 1:9f1974b0960d 142 /* Marking the current position. */
Davidroid 1:9f1974b0960d 143 motors[0]->SetMark();
Davidroid 1:9f1974b0960d 144
Davidroid 1:9f1974b0960d 145 /* Waiting. */
Davidroid 1:9f1974b0960d 146 wait_ms(DELAY_1);
Davidroid 1:9f1974b0960d 147
Davidroid 1:9f1974b0960d 148 /* Printing to the console. */
Davidroid 1:9f1974b0960d 149 printf("--> Moving backward %d steps.\r\n", STEPS_2);
Davidroid 1:9f1974b0960d 150
Davidroid 1:9f1974b0960d 151 /* Moving. */
Davidroid 1:9f1974b0960d 152 motors[0]->Move(StepperMotor::BWD, STEPS_2);
Davidroid 1:9f1974b0960d 153
Davidroid 1:9f1974b0960d 154 /* Waiting while active. */
Davidroid 1:9f1974b0960d 155 motors[0]->WaitWhileActive();
Davidroid 0:5148e9486cf2 156
Davidroid 1:9f1974b0960d 157 /* Waiting. */
Davidroid 1:9f1974b0960d 158 wait_ms(DELAY_1);
Davidroid 1:9f1974b0960d 159
Davidroid 1:9f1974b0960d 160 /* Getting the current position. */
Davidroid 1:9f1974b0960d 161 position = motors[0]->GetPosition();
Davidroid 1:9f1974b0960d 162
Davidroid 1:9f1974b0960d 163 /* Printing to the console. */
Davidroid 1:9f1974b0960d 164 printf("--> Getting the current position: %d\r\n", position);
Davidroid 1:9f1974b0960d 165
Davidroid 1:9f1974b0960d 166 /* Waiting. */
Davidroid 1:9f1974b0960d 167 wait_ms(DELAY_1);
Davidroid 0:5148e9486cf2 168
Davidroid 1:9f1974b0960d 169 /* Printing to the console. */
Davidroid 1:9f1974b0960d 170 printf("--> Going to marked position.\r\n");
Davidroid 0:5148e9486cf2 171
Davidroid 1:9f1974b0960d 172 /* Going to marked position. */
Davidroid 1:9f1974b0960d 173 motors[0]->GoMark();
Davidroid 1:9f1974b0960d 174
Davidroid 1:9f1974b0960d 175 /* Waiting while active. */
Davidroid 1:9f1974b0960d 176 motors[0]->WaitWhileActive();
Davidroid 0:5148e9486cf2 177
Davidroid 1:9f1974b0960d 178 /* Waiting. */
Davidroid 1:9f1974b0960d 179 wait_ms(DELAY_1);
Davidroid 0:5148e9486cf2 180
Davidroid 1:9f1974b0960d 181 /* Getting the current position. */
Davidroid 1:9f1974b0960d 182 position = motors[0]->GetPosition();
Davidroid 1:9f1974b0960d 183
Davidroid 1:9f1974b0960d 184 /* Printing to the console. */
Davidroid 1:9f1974b0960d 185 printf("--> Getting the current position: %d\r\n", position);
Davidroid 0:5148e9486cf2 186
Davidroid 1:9f1974b0960d 187 /* Waiting. */
Davidroid 1:9f1974b0960d 188 wait_ms(DELAY_1);
Davidroid 1:9f1974b0960d 189
Davidroid 1:9f1974b0960d 190 /* Printing to the console. */
Davidroid 1:9f1974b0960d 191 printf("--> Going to home position.\r\n");
Davidroid 0:5148e9486cf2 192
Davidroid 1:9f1974b0960d 193 /* Going to home position. */
Davidroid 1:9f1974b0960d 194 motors[0]->GoHome();
Davidroid 1:9f1974b0960d 195
Davidroid 1:9f1974b0960d 196 /* Waiting while active. */
Davidroid 1:9f1974b0960d 197 motors[0]->WaitWhileActive();
Davidroid 1:9f1974b0960d 198
Davidroid 1:9f1974b0960d 199 /* Waiting. */
Davidroid 1:9f1974b0960d 200 wait_ms(DELAY_1);
Davidroid 0:5148e9486cf2 201
Davidroid 1:9f1974b0960d 202 /* Getting the current position. */
Davidroid 1:9f1974b0960d 203 position = motors[0]->GetPosition();
Davidroid 1:9f1974b0960d 204
Davidroid 1:9f1974b0960d 205 /* Printing to the console. */
Davidroid 1:9f1974b0960d 206 printf("--> Getting the current position: %d\r\n", position);
Davidroid 1:9f1974b0960d 207
Davidroid 1:9f1974b0960d 208 /* Waiting. */
Davidroid 1:9f1974b0960d 209 wait_ms(DELAY_2);
Davidroid 0:5148e9486cf2 210
Davidroid 0:5148e9486cf2 211
Davidroid 1:9f1974b0960d 212 /*----- Running together for a certain amount of time. -----*/
Davidroid 1:9f1974b0960d 213
Davidroid 1:9f1974b0960d 214 /* Printing to the console. */
Davidroid 1:9f1974b0960d 215 printf("--> Running together for %d seconds.\r\n", DELAY_3 / 1000);
Davidroid 0:5148e9486cf2 216
Davidroid 1:9f1974b0960d 217 /* Preparing each motor to perform a run at a specified speed. */
Davidroid 1:9f1974b0960d 218 for (int m = 0; m < L6470DAISYCHAINSIZE; m++)
Davidroid 1:9f1974b0960d 219 motors[m]->PrepareRun(StepperMotor::BWD, 400);
Davidroid 0:5148e9486cf2 220
Davidroid 1:9f1974b0960d 221 /* Performing the action on each motor at the same time. */
Davidroid 1:9f1974b0960d 222 x_nucleo_ihm02a1->PerformPreparedActions();
Davidroid 0:5148e9486cf2 223
Davidroid 1:9f1974b0960d 224 /* Waiting. */
Davidroid 1:9f1974b0960d 225 wait_ms(DELAY_3);
Davidroid 1:9f1974b0960d 226
Davidroid 1:9f1974b0960d 227
Davidroid 1:9f1974b0960d 228 /*----- Increasing the speed while running. -----*/
Davidroid 0:5148e9486cf2 229
Davidroid 1:9f1974b0960d 230 /* Preparing each motor to perform a run at a specified speed. */
Davidroid 1:9f1974b0960d 231 for (int m = 0; m < L6470DAISYCHAINSIZE; m++)
Davidroid 1:9f1974b0960d 232 motors[m]->PrepareGetSpeed();
Davidroid 0:5148e9486cf2 233
Davidroid 1:9f1974b0960d 234 /* Performing the action on each motor at the same time. */
Davidroid 1:9f1974b0960d 235 uint32_t* results = x_nucleo_ihm02a1->PerformPreparedActions();
Davidroid 0:5148e9486cf2 236
Davidroid 1:9f1974b0960d 237 /* Printing to the console. */
Davidroid 1:9f1974b0960d 238 printf(" Speed: M1 %d, M2 %d.\r\n", results[0], results[1]);
Davidroid 1:9f1974b0960d 239
Davidroid 1:9f1974b0960d 240 /* Printing to the console. */
Davidroid 1:9f1974b0960d 241 printf("--> Doublig the speed while running.\r\n");
Davidroid 0:5148e9486cf2 242
Davidroid 1:9f1974b0960d 243 /* Preparing each motor to perform a run at a specified speed. */
Davidroid 1:9f1974b0960d 244 for (int m = 0; m < L6470DAISYCHAINSIZE; m++)
Davidroid 1:9f1974b0960d 245 motors[m]->PrepareRun(StepperMotor::BWD, results[m] << 1);
Davidroid 1:9f1974b0960d 246
Davidroid 1:9f1974b0960d 247 /* Performing the action on each motor at the same time. */
Davidroid 1:9f1974b0960d 248 results = x_nucleo_ihm02a1->PerformPreparedActions();
Davidroid 0:5148e9486cf2 249
Davidroid 1:9f1974b0960d 250 /* Waiting. */
Davidroid 1:9f1974b0960d 251 wait_ms(DELAY_3);
Davidroid 0:5148e9486cf2 252
Davidroid 1:9f1974b0960d 253 /* Preparing each motor to perform a run at a specified speed. */
Davidroid 1:9f1974b0960d 254 for (int m = 0; m < L6470DAISYCHAINSIZE; m++)
Davidroid 1:9f1974b0960d 255 motors[m]->PrepareGetSpeed();
Davidroid 0:5148e9486cf2 256
Davidroid 1:9f1974b0960d 257 /* Performing the action on each motor at the same time. */
Davidroid 1:9f1974b0960d 258 results = x_nucleo_ihm02a1->PerformPreparedActions();
Davidroid 0:5148e9486cf2 259
Davidroid 1:9f1974b0960d 260 /* Printing to the console. */
Davidroid 1:9f1974b0960d 261 printf(" Speed: M1 %d, M2 %d.\r\n", results[0], results[1]);
Davidroid 1:9f1974b0960d 262
Davidroid 1:9f1974b0960d 263 /* Waiting. */
Davidroid 1:9f1974b0960d 264 wait_ms(DELAY_1);
Davidroid 0:5148e9486cf2 265
Davidroid 0:5148e9486cf2 266
Davidroid 1:9f1974b0960d 267 /*----- Hard Stop. -----*/
Davidroid 0:5148e9486cf2 268
Davidroid 1:9f1974b0960d 269 /* Printing to the console. */
Davidroid 1:9f1974b0960d 270 printf("--> Hard Stop.\r\n");
Davidroid 0:5148e9486cf2 271
Davidroid 1:9f1974b0960d 272 /* Preparing each motor to perform a hard stop. */
Davidroid 1:9f1974b0960d 273 for (int m = 0; m < L6470DAISYCHAINSIZE; m++)
Davidroid 1:9f1974b0960d 274 motors[m]->PrepareHardStop();
Davidroid 0:5148e9486cf2 275
Davidroid 1:9f1974b0960d 276 /* Performing the action on each motor at the same time. */
Davidroid 1:9f1974b0960d 277 x_nucleo_ihm02a1->PerformPreparedActions();
Davidroid 0:5148e9486cf2 278
Davidroid 1:9f1974b0960d 279 /* Waiting. */
Davidroid 1:9f1974b0960d 280 wait_ms(DELAY_2);
Davidroid 0:5148e9486cf2 281
Davidroid 0:5148e9486cf2 282
Davidroid 1:9f1974b0960d 283 /*----- Doing a full revolution on each motor, one after the other. -----*/
Davidroid 1:9f1974b0960d 284
Davidroid 1:9f1974b0960d 285 /* Printing to the console. */
Davidroid 1:9f1974b0960d 286 printf("--> Doing a full revolution on each motor, one after the other.\r\n");
Davidroid 1:9f1974b0960d 287
Davidroid 1:9f1974b0960d 288 /* Doing a full revolution on each motor, one after the other. */
Davidroid 1:9f1974b0960d 289 for (int m = 0; m < L6470DAISYCHAINSIZE; m++)
Davidroid 1:9f1974b0960d 290 for (int i = 0; i < MPR_1; i++)
Davidroid 1:9f1974b0960d 291 {
Davidroid 1:9f1974b0960d 292 /* Computing the number of steps. */
Davidroid 1:9f1974b0960d 293 int steps = (int) (((int) X_NUCLEO_IHM02A1::MotorParameterInitData[0][m].fullstepsperrevolution * pow(2.0f, X_NUCLEO_IHM02A1::MotorParameterInitData[0][m].step_sel)) / MPR_1);
Davidroid 1:9f1974b0960d 294
Davidroid 1:9f1974b0960d 295 /* Moving. */
Davidroid 1:9f1974b0960d 296 motors[m]->Move(StepperMotor::FWD, steps);
Davidroid 1:9f1974b0960d 297
Davidroid 1:9f1974b0960d 298 /* Waiting while active. */
Davidroid 1:9f1974b0960d 299 motors[m]->WaitWhileActive();
Davidroid 1:9f1974b0960d 300
Davidroid 1:9f1974b0960d 301 /* Waiting. */
Davidroid 1:9f1974b0960d 302 wait_ms(DELAY_1);
Davidroid 1:9f1974b0960d 303 }
Davidroid 1:9f1974b0960d 304
Davidroid 1:9f1974b0960d 305 /* Waiting. */
Davidroid 1:9f1974b0960d 306 wait_ms(DELAY_2);
Davidroid 1:9f1974b0960d 307
Davidroid 1:9f1974b0960d 308
Davidroid 1:9f1974b0960d 309 /*----- High Impedance State. -----*/
Davidroid 1:9f1974b0960d 310
Davidroid 1:9f1974b0960d 311 /* Printing to the console. */
Davidroid 1:9f1974b0960d 312 printf("--> High Impedance State.\r\n");
Davidroid 1:9f1974b0960d 313
Davidroid 1:9f1974b0960d 314 /* Preparing each motor to set High Impedance State. */
Davidroid 1:9f1974b0960d 315 for (int m = 0; m < L6470DAISYCHAINSIZE; m++)
Davidroid 1:9f1974b0960d 316 motors[m]->PrepareHardHiZ();
Davidroid 1:9f1974b0960d 317
Davidroid 1:9f1974b0960d 318 /* Performing the action on each motor at the same time. */
Davidroid 1:9f1974b0960d 319 x_nucleo_ihm02a1->PerformPreparedActions();
Davidroid 1:9f1974b0960d 320
Davidroid 1:9f1974b0960d 321 /* Waiting. */
Davidroid 1:9f1974b0960d 322 wait_ms(DELAY_2);
Davidroid 0:5148e9486cf2 323 }