Test program for MMA8451Q

Dependencies:   MMA8451Q mbed

Files at this revision

API Documentation at this revision

Comitter:
Rhyme
Date:
Thu May 18 02:32:20 2017 +0000
Parent:
1:61ac5dab9c3e
Commit message:
print format modified, now CSV compatible

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Apr 28 02:01:43 2017 +0000
+++ b/main.cpp	Thu May 18 02:32:20 2017 +0000
@@ -5,7 +5,6 @@
 MMA8451Q *acc = 0 ;
 
 int main() {
-    int16_t ix, iy, iz ;
     float fx, fy, fz ;
 
 #if 0 // for  FRDM-KL25Z ONBOARDSENSOR
@@ -16,16 +15,13 @@
 #endif 
 
     printf("=== test MMA8451Q for %s (%s) ===\n", BOARD_NAME, __DATE__) ;
+    printf("    X,    Y,   Z\n") ;
  
     while(1) {
-        ix = acc->getRawX() ;   
-        iy = acc->getRawY() ;
-        iz = acc->getRawZ() ;
         fx = acc->getAccX() ;
         fy = acc->getAccY() ;
         fz = acc->getAccZ() ;
-        printf("X = %6d [ %.2f ], Y = %6d [ %.2f ], Z = %6d [ %.2f ]\n",
-            ix, fx, iy, fy, iz, fz ) ;
+        printf("%.2f, %.2f, %.2f\n", fx, fy, fz ) ;
         wait(0.2) ;
     }
 }