test water meter

Dependencies:   MAG3110 MMA8451Q TSI mbed

Files at this revision

API Documentation at this revision

Comitter:
ratsept
Date:
Thu Oct 15 12:01:53 2015 +0000
Parent:
0:6e75a6dbdc05
Commit message:
mj?u

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu May 28 07:32:17 2015 +0000
+++ b/main.cpp	Thu Oct 15 12:01:53 2015 +0000
@@ -9,7 +9,7 @@
 int main(void) {
     
     MAG3110 mag(PTE0,PTE1,&pc);
-    mag.setCalibration(64140,64550,900,1145);
+    //mag.setCalibration(64140,64550,900,1145);
     
     MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
     PwmOut rled(LED_RED);
@@ -17,13 +17,21 @@
     PwmOut bled(LED_BLUE);
     
     int x,y,z;
+    int xnew = 0;
  
     while (true) {
         mag.getValues(&x, &y, &z);
-        pc.printf("x=%d y=%d z=%d\n\r", x, y, z);
+        pc.printf("%d %d %d\n\r", x, y, z);
+        
+        float xnew = x;
+        float ynew = y;
+        float znew = z;
+        
         rled = 1.0 - abs(float(x)/65535);
         gled = 1.0 - abs(float(y)/65535);
         bled = 1.0 - abs(float(z)/65535);
+        
+
         //rled = 1.0 - abs(acc.getAccX());
         //gled = 1.0 - abs(acc.getAccY());
         //bled = 1.0 - abs(acc.getAccZ());