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:
- 21:08ddc48353ac
- Parent:
- 20:4f0729b99bf5
diff -r 4f0729b99bf5 -r 08ddc48353ac main.cpp --- a/main.cpp Fri Mar 11 16:14:46 2016 +0000 +++ b/main.cpp Thu Apr 07 16:51:24 2016 +0000 @@ -132,7 +132,7 @@ motor->SetMaxSpeed(speed); /* Printing to the console. */ - printf("Speed: %c%d %d\r\n", sign == -1 ? '-' : '+', motor->GetSpeed(), motor->GetDirection()); + printf("Speed: %c%d\r\n", sign == -1 ? '-' : '+', motor->GetSpeed()); } else if (status != 0) {