This program reads the MMA7455 Accelerometer unit on the LPC4088 Base Board and outputs to UART

Dependencies:   EALib mbed

Files at this revision

API Documentation at this revision

Comitter:
lhinh3431
Date:
Tue Oct 13 00:33:19 2015 +0000
Commit message:
Test for MMA7455 Accelerometer unit on the LPC4088. This program displays the [x,y,z] to UART

Changed in this revision

EALib.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/EALib.lib	Tue Oct 13 00:33:19 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/embeddedartists/code/EALib/#e1e36493f347
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 13 00:33:19 2015 +0000
@@ -0,0 +1,22 @@
+#include "mbed.h"
+#include "MMA7455.h"
+
+MMA7455 sens(P0_27,P0_28);
+Serial pc(USBTX, USBRX);
+
+int main()
+{
+    pc.baud(19200);
+    int x,y,z;//val[3] = [0,0,0];
+    pc.printf("[X, Y, Z] = \n\r");
+    
+    while(!sens.setMode(MMA7455::ModeMeasurement)); //Setting mode : Measurement
+    while(!sens.calibrate());                       //Calibrating axis
+    
+    while(1)
+    {        
+        sens.read(x, y, z);
+        pc.printf("[%d.1, %d.1, %d.1]\r", x, y, z);
+        wait(2);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 13 00:33:19 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68
\ No newline at end of file