aa

Dependencies:   MMA8451Q TSI USBDevice mbed

Files at this revision

API Documentation at this revision

Comitter:
anmolhardik
Date:
Thu Feb 09 13:47:01 2017 +0000
Commit message:
a

Changed in this revision

MMA8451Q.lib Show annotated file Show diff for this revision Revisions of this file
TSI.lib Show annotated file Show diff for this revision Revisions of this file
USBDevice.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 05ba5d2c26d8 MMA8451Q.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA8451Q.lib	Thu Feb 09 13:47:01 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/anmolhardik/code/MMA8451Q/#04d120de793d
diff -r 000000000000 -r 05ba5d2c26d8 TSI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TSI.lib	Thu Feb 09 13:47:01 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/emilmont/code/TSI/#507b1f67804b
diff -r 000000000000 -r 05ba5d2c26d8 USBDevice.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Thu Feb 09 13:47:01 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbed_official/code/USBDevice/#01321bd6ff89
diff -r 000000000000 -r 05ba5d2c26d8 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Feb 09 13:47:01 2017 +0000
@@ -0,0 +1,53 @@
+#include "mbed.h"
+#include "USBMouse.h"
+#include "TSISensor.h"
+#include "MMA8451Q.h"
+Serial pc(USBTX,USBRX);
+MMA8451Q acc(PTE25,PTE24,(0x1d<<1));
+BusOut led (PTB18,PTB19,PTD1);
+USBMouse Mouse;
+TSISensor tsi;
+int main()
+{
+    float tsi_value,x,y;
+    char c;
+    int a;
+   while(1)
+   {
+     if(pc.readable())
+      {
+       c=pc.getc();
+       if(c=='A')
+       a=5;     
+       else if(c=='B')
+       a=7;
+       else if(c=='C')
+       a=15;
+       else if(c=='D')
+       a=20;
+       else if(c=='E')
+       a=20;
+       }
+     tsi_value=tsi.readPercentage(); //0.0 to 1.0
+     Mouse.move(x,y);
+     y=acc.getAccX()*a;
+     x=-acc.getAccY()*a;
+     if ((tsi_value>0.0)&&(tsi_value<=0.4))
+      {
+          Mouse.press(MOUSE_LEFT);
+          
+       }   
+     else if ((tsi_value>=0.6)&&(tsi_value<=1.0))
+       {
+           Mouse.press(MOUSE_RIGHT);
+           
+        }    
+            else
+            {
+                Mouse.release(MOUSE_LEFT); 
+                Mouse.release(MOUSE_RIGHT);
+            }
+   }
+} 
+    
+
diff -r 000000000000 -r 05ba5d2c26d8 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Feb 09 13:47:01 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/176b8275d35d
\ No newline at end of file