Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main_mouse.cpp@2:c0c2a61188a9, 2016-01-18 (annotated)
- Committer:
- va009039
- Date:
- Mon Jan 18 10:48:16 2016 +0000
- Revision:
- 2:c0c2a61188a9
- Parent:
- 1:eea17a20509b
for NUCLEO-F042K6
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 |