USB Mouse (relative) example for mbed NXP LPC11U24 beta
main.cpp@1:e089be2a6aa1, 2011-11-09 (annotated)
- Committer:
- chris
- Date:
- Wed Nov 09 15:55:10 2011 +0000
- Revision:
- 1:e089be2a6aa1
- Parent:
- 0:163560051396
removed include for <math.h> that is already included by mbed.h
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 | |
chris | 0:163560051396 | 4 | USBMouse mouse; |
chris | 0:163560051396 | 5 | |
chris | 0:163560051396 | 6 | int main(void) { |
chris | 0:163560051396 | 7 | |
chris | 0:163560051396 | 8 | int16_t x = 0; |
chris | 0:163560051396 | 9 | int16_t y = 0; |
chris | 0:163560051396 | 10 | int32_t radius = 10; |
chris | 0:163560051396 | 11 | int32_t angle = 0; |
chris | 0:163560051396 | 12 | |
chris | 0:163560051396 | 13 | while (1) { |
chris | 0:163560051396 | 14 | x = cos((double)angle*3.14/180.0)*radius; |
chris | 0:163560051396 | 15 | y = sin((double)angle*3.14/180.0)*radius; |
chris | 0:163560051396 | 16 | mouse.move(x, y); |
chris | 0:163560051396 | 17 | angle += 3; |
chris | 0:163560051396 | 18 | wait(0.001); |
chris | 0:163560051396 | 19 | } |
chris | 0:163560051396 | 20 | } |
chris | 0:163560051396 | 21 | |
chris | 0:163560051396 | 22 |