Jeffrey Resnik / Mbed 2 deprecated proj_test_shared

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 //create mouse object
00005 USBMouse mouse;
00006 
00007 int main()
00008 {
00009     int16_t x = 0;
00010     int16_t y = 0;
00011     int32_t radius = 10;
00012     int32_t angle = 0;
00013 
00014     while (1) {
00015         //will cause mouse to move in a circle
00016         x = cos((double)angle * 3.14 / 180.0) * radius;
00017         y = sin((double)angle * 3.14 / 180.0) * radius;
00018 
00019         //will move mouse x, y away from its previous position on the screen
00020         mouse.move(x, y);
00021         angle += 3;
00022         //ThisThread::sleep_for(10);
00023     }
00024 }