Prateek Agrawal
/
Surface_Orientation_Detector
3256
Revision 0:3014b1c9fb29, committed 2017-04-04
- Comitter:
- prtkmynk
- Date:
- Tue Apr 04 06:40:27 2017 +0000
- Commit message:
- 265
Changed in this revision
diff -r 000000000000 -r 3014b1c9fb29 MMA8451Q.lib --- /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
diff -r 000000000000 -r 3014b1c9fb29 main.cpp --- /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; + } +} + +}
diff -r 000000000000 -r 3014b1c9fb29 mbed.bld --- /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