ECE 4180 Lab 1 Part 5

Dependencies:   USBDevice mbed

Fork of USBMouse_NavSwitch by jim hamblen

Committer:
samux
Date:
Fri Nov 11 12:03:50 2011 +0000
Revision:
0:48fd0c31cef5
Child:
2:e7b766501add

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
samux 0:48fd0c31cef5 1 #include "mbed.h"
samux 0:48fd0c31cef5 2 #include "USBMouse.h"
samux 0:48fd0c31cef5 3
samux 0:48fd0c31cef5 4 USBMouse mouse;
samux 0:48fd0c31cef5 5
samux 0:48fd0c31cef5 6 int main() {
samux 0:48fd0c31cef5 7 int16_t x = 0;
samux 0:48fd0c31cef5 8 int16_t y = 0;
samux 0:48fd0c31cef5 9 int32_t radius = 10;
samux 0:48fd0c31cef5 10 int32_t angle = 0;
samux 0:48fd0c31cef5 11
samux 0:48fd0c31cef5 12 while (1) {
samux 0:48fd0c31cef5 13 x = cos((double)angle*3.14/180.0)*radius;
samux 0:48fd0c31cef5 14 y = sin((double)angle*3.14/180.0)*radius;
samux 0:48fd0c31cef5 15 mouse.move(x, y);
samux 0:48fd0c31cef5 16 angle += 3;
samux 0:48fd0c31cef5 17 wait(0.001);
samux 0:48fd0c31cef5 18 }
samux 0:48fd0c31cef5 19 }