4180
/
4180_lab1_part5_ec
ec
Fork of USBMouse_NavSwitch by
main.cpp@2:e7b766501add, 2011-11-30 (annotated)
- Committer:
- samux
- Date:
- Wed Nov 30 11:00:01 2011 +0000
- Revision:
- 2:e7b766501add
- Parent:
- 0:48fd0c31cef5
- Child:
- 3:b8caa902d79e
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 | 2:e7b766501add | 15 | mouse.move(x, y); |
samux | 2:e7b766501add | 16 | angle += 3; |
samux | 2:e7b766501add | 17 | wait(0.001); |
samux | 2:e7b766501add | 18 | } |
samux | 0:48fd0c31cef5 | 19 | } |