Adder Technology Test Department
/
mouse_spin
Whirly mouse for testing
Diff: main.cpp
- Revision:
- 0:566b32d3659c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Mar 23 12:59:41 2018 +0000 @@ -0,0 +1,24 @@ +#include "mbed.h" +#include "USBMouse.h" + +int main (void) +{ + USBMouse mouse(REL_MOUSE); + int16_t x = 0; + int16_t y = 0; + int32_t radius = 10; + int32_t angle = 0; + while(true) + { + angle = 0; + while (angle < 360) + { + x = cos((double)angle*3.14/180.0)*radius; + y = sin((double)angle*3.14/180.0)*radius; + + mouse.move(x, y); + angle += 3; + wait_ms(5); + } + } +} \ No newline at end of file