USB Mouse (relative) example for mbed NXP LPC11U24 beta
main.cpp@0:163560051396, 2011-10-24 (annotated)
- Committer:
- chris
- Date:
- Mon Oct 24 10:26:27 2011 +0000
- Revision:
- 0:163560051396
- Child:
- 1:e089be2a6aa1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:163560051396 | 1 | #include "mbed.h" |
chris | 0:163560051396 | 2 | #include "USBMouse.h" |
chris | 0:163560051396 | 3 | #include <math.h> |
chris | 0:163560051396 | 4 | |
chris | 0:163560051396 | 5 | USBMouse mouse; |
chris | 0:163560051396 | 6 | |
chris | 0:163560051396 | 7 | int main(void) { |
chris | 0:163560051396 | 8 | |
chris | 0:163560051396 | 9 | int16_t x = 0; |
chris | 0:163560051396 | 10 | int16_t y = 0; |
chris | 0:163560051396 | 11 | int32_t radius = 10; |
chris | 0:163560051396 | 12 | int32_t angle = 0; |
chris | 0:163560051396 | 13 | |
chris | 0:163560051396 | 14 | while (1) { |
chris | 0:163560051396 | 15 | x = cos((double)angle*3.14/180.0)*radius; |
chris | 0:163560051396 | 16 | y = sin((double)angle*3.14/180.0)*radius; |
chris | 0:163560051396 | 17 | mouse.move(x, y); |
chris | 0:163560051396 | 18 | angle += 3; |
chris | 0:163560051396 | 19 | wait(0.001); |
chris | 0:163560051396 | 20 | } |
chris | 0:163560051396 | 21 | } |
chris | 0:163560051396 | 22 | |
chris | 0:163560051396 | 23 |