USBMouse Hello World

Dependencies:   mbed USBDevice

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "USBMouse.h"
00003 
00004 USBMouse mouse;
00005 
00006 int main() {
00007     int16_t x = 0;
00008     int16_t y = 0;
00009     int32_t radius = 10;
00010     int32_t angle = 0;
00011 
00012     while (1) {
00013         x = cos((double)angle*3.14/180.0)*radius;
00014         y = sin((double)angle*3.14/180.0)*radius;
00015         
00016         mouse.move(x, y);
00017         angle += 3;
00018         wait(0.001);
00019     }
00020 }