Plot of accelerometers axis

Dependencies:   MMA8451Q mbed

Files at this revision

API Documentation at this revision

Comitter:
sarthakgadre
Date:
Sat Dec 03 11:18:16 2016 +0000
Commit message:
Plot of accelerometer

Changed in this revision

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
diff -r 000000000000 -r a0321e9eb2d8 MMA8451Q.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA8451Q.lib	Sat Dec 03 11:18:16 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/emilmont/code/MMA8451Q/#c4d879a39775
diff -r 000000000000 -r a0321e9eb2d8 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Dec 03 11:18:16 2016 +0000
@@ -0,0 +1,23 @@
+#include "mbed.h"
+
+#include"MMA8451Q.h"
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+Serial pc(USBTX,USBRX);//tx,rx
+
+int main()
+{
+    int x=0;
+    int y=0;
+    int z=0;
+    MMA8451Q acc(PTE25,PTE24,MMA8451_I2C_ADDRESS);
+    
+    while(1)
+    {
+        x=1000*acc.getAccY();
+        y=1000*acc.getAccX();
+        z=1000*acc.getAccZ();
+        
+        pc.printf("$%d %d %d;",x,y,z);
+        wait(0.1);
+        }
+        }
\ No newline at end of file
diff -r 000000000000 -r a0321e9eb2d8 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Dec 03 11:18:16 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb
\ No newline at end of file