
NUCLEO-F042K6 USBDevice example code
Dependencies: F042K6_USBDevice mbed
Fork of L152RE_USBDevice_example by
main_mouse.cpp@3:45c2b2d465c4, 2016-01-18 (annotated)
- Committer:
- va009039
- Date:
- Mon Jan 18 10:51:25 2016 +0000
- Revision:
- 3:45c2b2d465c4
- Parent:
- 2:c0c2a61188a9
use NUCLEO-F042K6 USBDevice
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 2:c0c2a61188a9 | 1 | #if 1 |
va009039 | 1:eea17a20509b | 2 | // https://developer.mbed.org/handbook/USBMouse |
va009039 | 0:3395699bd0df | 3 | #include "mbed.h" |
va009039 | 0:3395699bd0df | 4 | #include "USBMouse.h" |
va009039 | 0:3395699bd0df | 5 | |
va009039 | 0:3395699bd0df | 6 | int main() { |
va009039 | 0:3395699bd0df | 7 | USBMouse mouse; |
va009039 | 0:3395699bd0df | 8 | |
va009039 | 0:3395699bd0df | 9 | int16_t x = 0; |
va009039 | 0:3395699bd0df | 10 | int16_t y = 0; |
va009039 | 0:3395699bd0df | 11 | int32_t radius = 10; |
va009039 | 0:3395699bd0df | 12 | int32_t angle = 0; |
va009039 | 0:3395699bd0df | 13 | |
va009039 | 0:3395699bd0df | 14 | while (1) { |
va009039 | 0:3395699bd0df | 15 | x = cos((double)angle*3.14/180.0)*radius; |
va009039 | 0:3395699bd0df | 16 | y = sin((double)angle*3.14/180.0)*radius; |
va009039 | 0:3395699bd0df | 17 | |
va009039 | 0:3395699bd0df | 18 | mouse.move(x, y); |
va009039 | 0:3395699bd0df | 19 | angle += 3; |
va009039 | 1:eea17a20509b | 20 | wait(0.005); |
va009039 | 0:3395699bd0df | 21 | } |
va009039 | 0:3395699bd0df | 22 | } |
va009039 | 0:3395699bd0df | 23 | |
va009039 | 0:3395699bd0df | 24 | #endif |