USB HID Mouse demo for NXP Freedom Development Platform. Move automatically the mouse cursor circularly on the computer screen
Revision 0:004692590ee7, committed 2015-12-31
- 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
diff -r 000000000000 -r 004692590ee7 USBDevice.lib --- /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
diff -r 000000000000 -r 004692590ee7 main.cpp --- /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
diff -r 000000000000 -r 004692590ee7 mbed.bld --- /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