ST / Mbed 2 deprecated MemsMotorControl

Dependencies:   X_NUCLEO_IHM01A1 X_NUCLEO_IKS01A1 mbed

Fork of MemsMotorControl by ST Expansion SW Team

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.

Files at this revision

API Documentation at this revision

Comitter:
Davidroid
Date:
Wed Nov 18 19:18:00 2015 +0000
Parent:
4:778a7effb013
Child:
6:b09e55633002
Commit message:
+ Program updated to reflect the modifications to the "StepperMotor" abstract class.

Changed in this revision

X_NUCLEO_IHM01A1.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/X_NUCLEO_IHM01A1.lib	Fri Nov 13 13:00:51 2015 +0000
+++ b/X_NUCLEO_IHM01A1.lib	Wed Nov 18 19:18:00 2015 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/ST-Expansion-SW-Team/code/X_NUCLEO_IHM01A1/#83a1eb397a65
+https://developer.mbed.org/teams/ST-Expansion-SW-Team/code/X_NUCLEO_IHM01A1/#d3c78f12a78d
--- a/main.cpp	Fri Nov 13 13:00:51 2015 +0000
+++ b/main.cpp	Wed Nov 18 19:18:00 2015 +0000
@@ -58,7 +58,7 @@
 #define ACCELERATION_TH 50
 
 /* Rotation gain. */
-#define ROTATION_SPEED_GAIN 40
+#define ROTATION_SPEED_GAIN 20
 
 
 /* Variables -----------------------------------------------------------------*/
@@ -119,7 +119,7 @@
             /* Requesting to run. */
             if (status != sign)
             {
-                motor->Run(sign == -1 ? StepperMotor::CCW : StepperMotor::CW);
+                motor->Run(sign == -1 ? StepperMotor::BWD : StepperMotor::FWD);
                 status = sign;
             }