In-air mouse using Freedom board

Dependencies:   MMA8451Q TSI USBDevice mbed

Fork of USBMouse_HelloWorld by Samuel Mokrani

First project using (and testing out) the Freescale Freedom board.

Plug the USB (not SDA) connector into your machine.

Tilt the board to move the cursor, and use the touch sensor for left and right click.

main.cpp

Committer:
samux
Date:
2011-11-30
Revision:
2:e7b766501add
Parent:
0:48fd0c31cef5
Child:
3:b8caa902d79e

File content as of revision 2:e7b766501add:

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

USBMouse mouse;

int main() {
    int16_t x = 0;
    int16_t y = 0;
    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;
        mouse.move(x, y);
        angle += 3;
        wait(0.001);
    }
}