Simple application using the STMicroelectronics X-NUCLEO-IHM01A1 Stepper Motor Control Expansion Board and the X-NUCLEO-IKS01A1 MEMS Inertial and Environmental Sensors Expansion Board to get a MEMS-based motor control in terms of direction and speed.
Dependencies: X_NUCLEO_IHM01A1 X_NUCLEO_IKS01A1 mbed
Fork of MemsMotorControl by
MEMS-based Motor Control
This application provides an intuitive and natural way for controlling a stepper motor through an accelerometer. It makes use of the STMicroelectronics X-NUCLEO-IKS01A1 MEMS Inertial and Environmental Sensors Expansion Board to get accelerometer values and the X-NUCLEO-IHM01A1 Stepper Motor Control Expansion Board to directly control a stepper motor with:
- speed proportional to the angle measured by the MEMS board;
- direction driven by the direction of rotation captured by the MEMS board.
Diff: main.cpp
- Revision:
- 14:3f4dc127ac4b
- Parent:
- 9:218d1ac31590
- Child:
- 16:df53cf8dd1b4
--- a/main.cpp Thu Dec 10 15:14:47 2015 +0000 +++ b/main.cpp Mon Dec 14 17:32:48 2015 +0000 @@ -91,8 +91,8 @@ /* Initializing Motor Control Component. */ motor = new L6474(D2, D8, D7, D9, D10, dev_spi); - if (motor->Init(NULL) != COMPONENT_OK) - return false; + if (motor->Init() != COMPONENT_OK) + exit(EXIT_FAILURE); /* Set defaults. */ motor->SetAcceleration(10000);