Krist Niwatcharoenchaikul / Mbed 2 deprecated AccelTest

Dependencies:   FRDM_MMA8451Q mbed

Files at this revision

API Documentation at this revision

Comitter:
schematic
Date:
Wed Nov 13 11:13:43 2013 +0000
Commit message:
AccelTest

Changed in this revision

FRDM_MMA8451Q.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/FRDM_MMA8451Q.lib	Wed Nov 13 11:13:43 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/clemente/code/FRDM_MMA8451Q/#13e2af71e2cf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Nov 13 11:13:43 2013 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+
+#include "MMA8451Q.h" 
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+
+// --- Set Accelerometer 
+MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
+
+// --- Set Serial Port
+Serial pc(USBTX, USBRX); // tx, rxSerial pc(USBTX, USBRX); // tx, rx
+
+int main() {
+
+    //float aX;
+    //float aY;
+    float aZ;
+    
+    //float z1;
+    //float z2;
+    //float diff;
+    
+    // --- Baud rate setting
+    pc.baud(115200);
+    wait(1);
+
+    while(1) {
+        
+        //aX = acc.getAccX();
+        //aY = acc.getAccY();
+        aZ = acc.getAccZ();
+        
+        //sprintf(str, "%+6.*f", 4, val);
+        //printf("val = %s.\n", str);
+        //printf("%f\n", floatVal);
+        
+        
+        pc.printf("Z:%f<EOF>\r\n",aZ);
+
+        
+        //wait(0.02);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Nov 13 11:13:43 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9c8f0e3462fb
\ No newline at end of file