Erick Wan
/
USBKeyboard_HelloWorld
1
Fork of USBKeyboard_HelloWorld by
main.cpp@7:7d21d4350d5c, 2014-02-28 (annotated)
- Committer:
- wane
- Date:
- Fri Feb 28 05:14:03 2014 +0000
- Revision:
- 7:7d21d4350d5c
- Parent:
- 5:03a4211d593a
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
samux | 1:291a88a2c151 | 1 | #include "mbed.h" |
samux | 1:291a88a2c151 | 2 | #include "USBKeyboard.h" |
wane | 7:7d21d4350d5c | 3 | |
samux | 1:291a88a2c151 | 4 | //LED1: NUM_LOCK |
samux | 1:291a88a2c151 | 5 | //LED2: CAPS_LOCK |
samux | 1:291a88a2c151 | 6 | //LED3: SCROLL_LOCK |
wane | 7:7d21d4350d5c | 7 | //BusOut leds(LED1, LED2, LED3); |
wane | 7:7d21d4350d5c | 8 | DigitalIn fire(p14); |
wane | 7:7d21d4350d5c | 9 | |
samux | 3:8b56768ceca2 | 10 | //USBKeyboard |
samux | 3:8b56768ceca2 | 11 | USBKeyboard keyboard; |
wane | 7:7d21d4350d5c | 12 | DigitalOut led(LED1); |
wane | 7:7d21d4350d5c | 13 | |
wane | 7:7d21d4350d5c | 14 | int main(void) |
wane | 7:7d21d4350d5c | 15 | { |
wane | 7:7d21d4350d5c | 16 | bool pause = false; |
samux | 1:291a88a2c151 | 17 | while (1) { |
wane | 7:7d21d4350d5c | 18 | if (!pause) { |
wane | 7:7d21d4350d5c | 19 | //keyboard.mediaControl(KEY_VOLUME_DOWN); |
wane | 7:7d21d4350d5c | 20 | keyboard.printf("Hello World from Mbed\r\n"); |
wane | 7:7d21d4350d5c | 21 | //keyboard.keyCode('s', KEY_CTRL); |
wane | 7:7d21d4350d5c | 22 | //keyboard.keyCode(KEY_CAPS_LOCK); |
wane | 7:7d21d4350d5c | 23 | } |
samux | 4:f0df6aae7147 | 24 | wait(1); |
wane | 7:7d21d4350d5c | 25 | //leds = keyboard.lockStatus(); |
wane | 7:7d21d4350d5c | 26 | if (fire) |
wane | 7:7d21d4350d5c | 27 | { |
wane | 7:7d21d4350d5c | 28 | pause = !pause; |
wane | 7:7d21d4350d5c | 29 | led = !led; |
wane | 7:7d21d4350d5c | 30 | } |
samux | 1:291a88a2c151 | 31 | } |
samux | 4:f0df6aae7147 | 32 | } |