USB HID Mouse demo for NXP Freedom Development Platform. Move automatically the mouse cursor circularly on the computer screen

Dependencies:   USBDevice mbed

Files at this revision

API Documentation at this revision

Comitter:
GregC
Date:
Thu Dec 31 17:03:42 2015 +0000
Commit message:
USB HID Mouse demo for NXP Freedom Development Platform. Move automatically the mouse cursor circularly on the computer screen

Changed in this revision

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/USBDevice.lib	Thu Dec 31 17:03:42 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/USBDevice/#5b7d31d9d3f3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Dec 31 17:03:42 2015 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+#include "USBMouse.h"
+#include <math.h>
+
+USBMouse mouse(ABS_MOUSE);
+
+  int main(void)
+  {
+    uint16_t x_center = (X_MAX_ABS - X_MIN_ABS)/2;
+    uint16_t y_center = (Y_MAX_ABS - Y_MIN_ABS)/2;
+    uint16_t x_screen = 0;
+    uint16_t y_screen = 0;
+    
+    uint32_t x_origin = x_center;
+    uint32_t y_origin = y_center;
+    uint32_t radius = 5000;
+    uint32_t angle = 0;
+ 
+    while (1)
+    {
+        x_screen = x_origin + cos((double)angle*3.14/180.0)*radius;
+        y_screen = y_origin + sin((double)angle*3.14/180.0)*radius;
+        
+        mouse.move(x_screen, y_screen);
+        angle += 3;
+        wait(0.01);
+    }
+  }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Dec 31 17:03:42 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6473597d706e
\ No newline at end of file