Samuel Mokrani
/
USBMouseKeyboard_HelloWorld
USBMouseKeyboard Hello World
main.cpp@5:656591c7c89f, 2012-10-14 (annotated)
- Committer:
- samux
- Date:
- Sun Oct 14 12:51:33 2012 +0000
- Revision:
- 5:656591c7c89f
- Parent:
- 4:13ddb5cb421b
use mbed official USBDevice library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
samux | 0:845782b77b0d | 1 | #include "mbed.h" |
samux | 0:845782b77b0d | 2 | #include "USBMouseKeyboard.h" |
samux | 5:656591c7c89f | 3 | |
samux | 3:f34d255ad5e7 | 4 | //LED1: NUM_LOCK |
samux | 3:f34d255ad5e7 | 5 | //LED2: CAPS_LOCK |
samux | 3:f34d255ad5e7 | 6 | //LED3: SCROLL_LOCK |
samux | 1:980859c25e92 | 7 | BusOut leds(LED1, LED2, LED3); |
samux | 5:656591c7c89f | 8 | |
samux | 3:f34d255ad5e7 | 9 | //USBMouseKeyboard |
samux | 3:f34d255ad5e7 | 10 | USBMouseKeyboard key_mouse; |
samux | 5:656591c7c89f | 11 | |
samux | 0:845782b77b0d | 12 | int main(void) { |
samux | 0:845782b77b0d | 13 | while (1) { |
samux | 0:845782b77b0d | 14 | key_mouse.mediaControl(KEY_VOLUME_DOWN); |
samux | 0:845782b77b0d | 15 | key_mouse.printf("Hello World from Mbed\r\n"); |
samux | 0:845782b77b0d | 16 | key_mouse.keyCode('s', KEY_CTRL); |
samux | 0:845782b77b0d | 17 | key_mouse.move(20, 0); |
samux | 1:980859c25e92 | 18 | key_mouse.keyCode(KEY_SCROLL_LOCK); |
samux | 4:13ddb5cb421b | 19 | wait(1); |
samux | 3:f34d255ad5e7 | 20 | leds = key_mouse.lockStatus(); |
samux | 0:845782b77b0d | 21 | } |
samux | 5:656591c7c89f | 22 | } |