Emulate a mouse using FRDM KL25Z. MMA8451Q accelerometer used for orientation and TSI capacitive touch sensor used for right and Left Click. USBHID class library used for USB protocol implementation.

Dependencies:   MMA8451Q TSI USBDevice mbed

Files at this revision

API Documentation at this revision

Comitter:
priyankapashte
Date:
Sat Dec 12 04:23:31 2015 +0000
Commit message:
ESD Final Project; ; PC Mouse

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA8451Q.lib	Sat Dec 12 04:23:31 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/JoKer/code/MMA8451Q/#2d14600116fc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TSI.lib	Sat Dec 12 04:23:31 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/vsluiter/code/TSI/#4dc2f5a3a731
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Sat Dec 12 04:23:31 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/USBDevice/#0c6524151939
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Dec 12 04:23:31 2015 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+#include "MMA8451Q.h"
+ #include "USBMouse.h"
+ #include "TSISensor.h"
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+ 
+ Serial pc(USBTX, USBRX); 
+ 
+int main(void) {
+    MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
+    TSISensor tsi;
+    while (true) {
+         float X=acc.getAccX();
+        float Y=acc.getAccY();  
+        mouse.move(Y,X);
+        if(tsi.readPercentage()>0)
+        if(tsi.readPercentage()<=0.6)
+        {
+            mouse.press(MOUSE_LEFT);
+            pc.printf("Left\n");
+        }
+        if(tsi.readPercentage()>0.6)
+        {
+            mouse.press(MOUSE_LEFT);
+            pc.printf("Right");
+        }
+        wait(0.5);     
+        }
+    
+}
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Dec 12 04:23:31 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/024bf7f99721
\ No newline at end of file