Lab 3 part 2 - USBMouse

Dependencies:   USBDevice mbed

Fork of FTF2014_lab3_part1 by Freescale

Committer:
Kojto
Date:
Mon Apr 07 19:14:18 2014 +0000
Revision:
1:4dc9e426a29b
Parent:
0:8fee585e7c6d
mbed-src replaced by mbed lib v82

Who changed what in which revision?

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