test

Dependencies:   mbed MMA8452Q

Fork of HelloWorld by Simon Ford

Revision:
13:64137db317ab
Parent:
11:5499b22fd01e
Child:
15:b4b2e73faefb
--- a/main.cpp	Wed Aug 30 20:46:59 2017 +0000
+++ b/main.cpp	Thu Aug 31 15:27:13 2017 +0000
@@ -17,16 +17,26 @@
          x = acc.getAccX() ;
          y = acc.getAccY() ;
          z = acc.getAccZ() ;
-         printf("X[%.2f] Y[%.2f] Z[%.2f]\n",x, y, z) ;
+        // printf("X[%.2f] Y[%.2f] Z[%.2f]\n",x, y, z) ;
          wait(0.1);
+
+        float resultat = (3.14/2.0) -( z + (z *z * z)/6.0 + (3*z*z*z*z*z)/40.0);
+         pc.printf("valeur rad = %f", resultat);
+         float degree = resultat * 18000.0/314.0;
+         pc.printf("valeur deg = %f", degree);
+         degree = degree * 10;
+         int degreInt = (int)degree;
+         pc.printf("valeur deg = %d", degreInt);
          
-         int numx = (int)x;
+         //degreInt
          
+         
+         /*
          cs = 0;
          accel.write(x);
          cs = 1;
          wait(0.2);
-         cs = 0;
+         cs = 0;*/
          wait(1); 
         }
 }