Used the onboard accelerometer (Freescale MMA8451Q) and capacitive sensor APIs of MBED and developed a mouse that alters its sensitivity with respect to the user input. Extended the gesture USB mouse to give it a wireless capability using an nRF24L01P RX-TX pair.

Dependencies:   mbed TSI MMA8451Q USBDevice

Files at this revision

API Documentation at this revision

Comitter:
pratik_sheth_
Date:
Wed Jan 23 16:56:28 2019 +0000
Commit message:
Used the onboard accelerometer (Freescale MMA8451Q) and capacitive sensor APIs of MBED and developed a mouse that alters its sensitivity with respect to the user input. Extended with wireless capability using nRF module

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	Wed Jan 23 16:56:28 2019 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/emilmont/code/MMA8451Q/#c4d879a39775
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TSI.lib	Wed Jan 23 16:56:28 2019 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/mbed/code/TSI/#1a60ef257879
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Wed Jan 23 16:56:28 2019 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/mbed_official/code/USBDevice/#7a8dce0a3c84
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jan 23 16:56:28 2019 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+#include "USBMouse.h"
+#include "MMA8451Q.h"
+#include "TSISensor.h"
+
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+
+MMA8451Q acc(PTE25,PTE24, MMA8451_I2C_ADDRESS);
+TSISensor tsi;
+USBMouse mouse;
+
+int main()
+{
+    int16_t x = 0;
+    int16_t y = 0;
+    int s=10;
+    
+    while(1)
+    {
+        x= -s*(acc.getAccY());
+        y= s*acc.getAccX();
+        
+        mouse.move(x,y);
+        
+        //left click
+        if (tsi.readPercentage() > 0.7)
+        {
+            mouse.press(MOUSE_LEFT);
+        }
+        else
+        {
+            mouse.release(MOUSE_LEFT);
+        }
+        //right click
+        if (tsi.readPercentage() < 0.3 && tsi.readPercentage() > 0)
+        {
+         mouse.press(MOUSE_RIGHT);
+        }
+        else
+        {
+            mouse.release(MOUSE_RIGHT);
+        }   
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Jan 23 16:56:28 2019 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7
\ No newline at end of file