USB HID Mouse demo for NXP Freedom Development Platform. Move automatically the mouse cursor circularly on the computer screen
main.cpp
- Committer:
- GregC
- Date:
- 2015-12-31
- Revision:
- 0:004692590ee7
File content as of revision 0:004692590ee7:
#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); } }