USBKeyboard Hello World

Dependencies:   mbed USBDevice

Files at this revision

API Documentation at this revision

Comitter:
samux
Date:
Fri Nov 11 12:06:21 2011 +0000
Parent:
0:c1db4aaad050
Child:
2:24dad6de0713
Commit message:

Changed in this revision

USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/USBDevice.lib	Thu Nov 03 12:11:29 2011 +0000
+++ b/USBDevice.lib	Fri Nov 11 12:06:21 2011 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/samux/code/USBDevice/#3ee092469cc8
+http://mbed.org/users/samux/code/USBDevice/#8d9f9651e3c0
--- a/main.cpp	Thu Nov 03 12:11:29 2011 +0000
+++ b/main.cpp	Fri Nov 11 12:06:21 2011 +0000
@@ -1,12 +1,20 @@
-#include "mbed.h"
-#include "USBKeyboard.h"
-
-USBKeyboard keyboard;
-
-int main(void) {
-    while (1) {
-        keyboard.mediaControl(KEY_VOLUME_DOWN);
-        keyboard.printf("Hello World from Mbed\r\n");
-        wait(1);
-    }
+#include "mbed.h"
+#include "USBKeyboard.h"
+
+//LED1: NUM_LOCK
+//LED2: CAPS_LOCK
+//LED3: SCROLL_LOCK
+BusOut leds(LED1, LED2, LED3);
+
+//USBKeyboard attached with led bus
+USBKeyboard keyboard(&leds);
+
+int main(void) {
+    while (1) {
+        keyboard.mediaControl(KEY_VOLUME_DOWN);
+        keyboard.printf("Hello World from Mbed\r\n");
+        keyboard.keyCode('s', KEY_CTRL);
+        keyboard.keyCode(KEY_CAPS_LOCK);
+        wait(1);
+    }
 }
\ No newline at end of file