4180
/
4180_lab1_part5_ec
ec
Fork of USBMouse_NavSwitch by
main.cpp@3:b8caa902d79e, 2012-10-14 (annotated)
- Committer:
- samux
- Date:
- Sun Oct 14 12:39:53 2012 +0000
- Revision:
- 3:b8caa902d79e
- Parent:
- 2:e7b766501add
- Child:
- 5:679a07e00e4c
use the latest USBDevice library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
samux | 2:e7b766501add | 1 | #include "mbed.h" |
samux | 2:e7b766501add | 2 | #include "USBMouse.h" |
samux | 2:e7b766501add | 3 | |
samux | 2:e7b766501add | 4 | USBMouse mouse; |
samux | 2:e7b766501add | 5 | |
samux | 2:e7b766501add | 6 | int main() { |
samux | 2:e7b766501add | 7 | int16_t x = 0; |
samux | 2:e7b766501add | 8 | int16_t y = 0; |
samux | 2:e7b766501add | 9 | int32_t radius = 10; |
samux | 2:e7b766501add | 10 | int32_t angle = 0; |
samux | 2:e7b766501add | 11 | |
samux | 2:e7b766501add | 12 | while (1) { |
samux | 2:e7b766501add | 13 | x = cos((double)angle*3.14/180.0)*radius; |
samux | 2:e7b766501add | 14 | y = sin((double)angle*3.14/180.0)*radius; |
samux | 3:b8caa902d79e | 15 | |
samux | 2:e7b766501add | 16 | mouse.move(x, y); |
samux | 2:e7b766501add | 17 | angle += 3; |
samux | 2:e7b766501add | 18 | wait(0.001); |
samux | 2:e7b766501add | 19 | } |
samux | 0:48fd0c31cef5 | 20 | } |