USBmouse

Dependencies:   USBDevice mbed

Fork of USBMouse_HelloWorld by Samuel Mokrani

main.cpp

Committer:
bhakti08
Date:
2014-02-19
Revision:
5:36a45d09bb56
Parent:
3:b8caa902d79e

File content as of revision 5:36a45d09bb56:

#include "mbed.h"
#include "USBMouse.h"
#include "DebouncedIn.h"


USBMouse mouse;
DigitalIn joy_left(p13);
DigitalIn joy_right(p16);
DigitalIn joy_up(p15);
DigitalIn joy_down(p12);

int main() {
    int16_t x = 600;
    int16_t y = 200;
    //int32_t radius = 10;
    //int32_t angle = 0;

    while (1) {
        //x = cos((double)angle*3.14/180.0)*radius;
        //y = sin((double)angle*3.14/180.0)*radius;
        if (joy_left)
           x = x-5;
        if (joy_right)
           x = x+5;
        if (joy_up)
           y = y+5;
        if (joy_down)
           y = y-5;
            
        
        mouse.move(x, y);
        //angle += 3;
        wait(0.001);
    }
}