..
Dependencies: MMA8451Q TSI USBDevice mbed
Revision 0:a3f78bcda713, committed 2017-02-09
- Comitter:
- anmolhardik
- Date:
- Thu Feb 09 13:43:14 2017 +0000
- Commit message:
- aa
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MMA8451Q.lib Thu Feb 09 13:43:14 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/TSI.lib Thu Feb 09 13:43:14 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/emilmont/code/TSI/#507b1f67804b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBDevice.lib Thu Feb 09 13:43:14 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/mbed_official/code/USBDevice/#01321bd6ff89
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Feb 09 13:43:14 2017 +0000 @@ -0,0 +1,49 @@ +#include "mbed.h" +#include "USBMouse.h" +#include "MMA8451Q.h" +#include "TSISensor.h" +Serial pc (USBTX,USBRX); +BusOut led (PTB18,PTB19,PTD1); +int main () +{ + USBMouse mouse; + MMA8451Q acc(PTE25,PTE24,0x1d<<1); + TSISensor tsi; + float x,y, tsi_value; + while(1) + { + x=-(acc.getAccY()*6); + y=acc.getAccX()*6; + mouse.move(x,y); + + tsi_value = tsi.readPercentage(); + if(tsi_value>0.0&&tsi_value<=0.4) + { + pc.printf("tsi value = %f\n\r",tsi_value); + + mouse.press(MOUSE_LEFT); + + + + led=0x6; + } + else if(tsi_value>=0.6&&tsi_value<=1.0) + { + pc.printf("tsi value= %f\n\r",tsi_value); + + mouse.press(MOUSE_RIGHT); + + + led=0x3; + } + else + { + + mouse.release(MOUSE_LEFT); + mouse.release(MOUSE_RIGHT); + } + + } +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Feb 09 13:43:14 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/176b8275d35d \ No newline at end of file