FRDM-K64f as air mouse

Dependencies:   mbed FXOS8700Q USBDevice

Files at this revision

API Documentation at this revision

Comitter:
dewantkatare
Date:
Thu Feb 07 02:08:11 2019 +0000
Commit message:
USB_Mouse

Changed in this revision

FXOS8700Q.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/FXOS8700Q.lib	Thu Feb 07 02:08:11 2019 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/JimCarver/code/FXOS8700Q/#5553a64d0762
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Thu Feb 07 02:08:11 2019 +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	Thu Feb 07 02:08:11 2019 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+#include "USBMouse.h"
+#include "FXOS8700Q.h"
+
+//I2C lines for FXOS8700Q accelerometer/magnetometer
+FXOS8700Q_acc acc(PTE25, PTE24, FXOS8700CQ_SLAVE_ADDR1);
+
+USBMouse mouse;
+ 
+int main() 
+{
+    acc.enable();
+    float faX, faY, faZ;
+    int16_t x = 0;
+    int16_t y = 0;
+    
+    while (1) 
+    {
+        //acc.getAxis(acc_data);
+        acc.getX(&faX);
+        acc.getY(&faY);
+        x = 10*faX;
+        y = 10*faY;
+        
+        mouse.move(x, y);
+        wait(0.001);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Feb 07 02:08:11 2019 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/024bf7f99721
\ No newline at end of file