test water meter

Dependencies:   MAG3110 MMA8451Q TSI mbed

Files at this revision

API Documentation at this revision

Comitter:
ratsept
Date:
Thu May 28 07:32:17 2015 +0000
Child:
1:43d8cd5f8197
Commit message:
Test;

Changed in this revision

MAG3110.lib Show annotated file Show diff for this revision Revisions of this file
MMA8451Q.lib Show annotated file Show diff for this revision Revisions of this file
TSI.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MAG3110.lib	Thu May 28 07:32:17 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/SomeRandomBloke/code/MAG3110/#cf40601402b7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA8451Q.lib	Thu May 28 07:32:17 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/JoKer/code/MMA8451Q/#2d14600116fc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TSI.lib	Thu May 28 07:32:17 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/vsluiter/code/TSI/#4dc2f5a3a731
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 28 07:32:17 2015 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+#include "MMA8451Q.h"
+#include "MAG3110.h"
+ 
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+
+Serial pc(USBTX,USBRX);
+ 
+int main(void) {
+    
+    MAG3110 mag(PTE0,PTE1,&pc);
+    mag.setCalibration(64140,64550,900,1145);
+    
+    MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
+    PwmOut rled(LED_RED);
+    PwmOut gled(LED_GREEN);
+    PwmOut bled(LED_BLUE);
+    
+    int x,y,z;
+ 
+    while (true) {
+        mag.getValues(&x, &y, &z);
+        pc.printf("x=%d y=%d z=%d\n\r", x, y, 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());
+        //mag.getValues(&x,&y,&z);
+        //pc.printf("%f\n\r",mag.getHeading());
+        wait(0.1);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 28 07:32:17 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17
\ No newline at end of file