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:
- 9:218d1ac31590
- Parent:
- 8:201bc01dcc1b
- Child:
- 14:3f4dc127ac4b
--- a/main.cpp Thu Nov 26 16:10:06 2015 +0000 +++ b/main.cpp Fri Nov 27 12:45:49 2015 +0000 @@ -74,6 +74,8 @@ int main() { + /*----- Initialization. -----*/ + /* Initializing I2C bus. */ DevI2C dev_i2c(D14, D15); @@ -99,6 +101,9 @@ int status = 0; int speed = 0; + + /*----- Infinite Loop. -----*/ + /* Printing to the console. */ printf("Motor Control with MEMS\r\n\n");