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.cpp@0:89d3ef1a9362, 2009-09-19 (annotated)
- Committer:
- chris
- Date:
- Sat Sep 19 07:47:37 2009 +0000
- Revision:
- 0:89d3ef1a9362
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| chris | 0:89d3ef1a9362 | 1 | #include "DemoBoard.h" |
| chris | 0:89d3ef1a9362 | 2 | |
| chris | 0:89d3ef1a9362 | 3 | /* |
| chris | 0:89d3ef1a9362 | 4 | * This project uses the USB interface configured as a mouse, using the HID device class |
| chris | 0:89d3ef1a9362 | 5 | * Thw X,Y pots give the mouse control, and the buttons are the mouse buttons |
| chris | 0:89d3ef1a9362 | 6 | */ |
| chris | 0:89d3ef1a9362 | 7 | |
| chris | 0:89d3ef1a9362 | 8 | int main() { |
| chris | 0:89d3ef1a9362 | 9 | |
| chris | 0:89d3ef1a9362 | 10 | while(1) { |
| chris | 0:89d3ef1a9362 | 11 | |
| chris | 0:89d3ef1a9362 | 12 | // read the pots, use them to offset and scale the X,Y values |
| chris | 0:89d3ef1a9362 | 13 | float mx = ((potx.read()-0.50f) * 100.0f); |
| chris | 0:89d3ef1a9362 | 14 | float my = ((poty.read()-0.54f) * 130.0f); |
| chris | 0:89d3ef1a9362 | 15 | |
| chris | 0:89d3ef1a9362 | 16 | // Call the mouse function with the X,Y and button status |
| chris | 0:89d3ef1a9362 | 17 | hid.mouse(mx, -my, RedButton.read()); |
| chris | 0:89d3ef1a9362 | 18 | } |
| chris | 0:89d3ef1a9362 | 19 | |
| chris | 0:89d3ef1a9362 | 20 | } |
| chris | 0:89d3ef1a9362 | 21 | |
| chris | 0:89d3ef1a9362 | 22 |