3256

Dependencies:   MMA8451Q mbed

Files at this revision

API Documentation at this revision

Comitter:
prtkmynk
Date:
Tue Apr 04 06:40:27 2017 +0000
Commit message:
265

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA8451Q.lib	Tue Apr 04 06:40:27 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/emilmont/code/MMA8451Q/#c4d879a39775
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Apr 04 06:40:27 2017 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+#include "MMA8451Q.h"
+
+MMA8451Q acc(PTE25,PTE24,0X1d<<1);
+Serial pc(USBTX,USBRX);
+
+BusOut myled(PTB18,PTB19,PTD1);
+float x,y;
+
+ int main()
+{ 
+    while(1)
+    { 
+    y = acc.getAccY();
+    x = acc.getAccX();
+    if ((x>-0.2 && x<0.2) && (y>-0.2 && y<0.2)){
+    pc.printf("NO Tilt in X direction");
+    myled = 0x06;
+    }
+    else if ((x>-0.6 && x<-0.2 | x> 0.2 && x<0.6) || (y>-0.6 && y<-0.2 | y> 0.2 && y<0.6) )
+    {
+        pc.printf("High Tilt in X Direction");
+        myled =0x05 ;
+    }
+
+    else if((x<-0.6 | x>0.6) || (y<-0.6 | y>0.6))
+    { pc.printf("extremely Tilted");
+      myled = 0x03;
+    }                           
+}
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Apr 04 06:40:27 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/856d2700e60b
\ No newline at end of file