IMU measurement + Speed controller

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
boro
Date:
Thu May 30 13:21:44 2019 +0000
Parent:
0:5a93e4916fb1
Commit message:
a

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu May 30 12:41:57 2019 +0000
+++ b/main.cpp	Thu May 30 13:21:44 2019 +0000
@@ -35,8 +35,8 @@
     enable = 1;
     
     // variables for measurement in one axis
-    int nData = 1500;
-    int nSave = 10;
+    int nData = 5000;
+    int nSave = 1;
     int delayMeasure = 3000;
     int   * T = new int[nData]();
     float * Mes1 = new float[nData]();
@@ -71,7 +71,7 @@
         float accX = imu.readAccelerationX();
 
         // save data in object measure-variables
-        if (t % nSave == 0) {
+        if (t % nSave == 0 && stable) {
                 *(T+mesInd) = t;
                 *(Mes1+mesInd) = accX;
                 *(Mes2+mesInd) = accX; 
@@ -80,8 +80,8 @@
         // reset index if array are full
         if(mesInd == nData){mesInd = 0;}
 
-        if(previousStable&&!stable){sendMeasure == true;}
-        previousStable = stable;
+        // stability condition
+        //if(...){stable = false;}
         
         // send measure to console
         if(sendMeasure) {