USBKeyboard "Hello world" example (LEDs setting removed as we don't have LEDs)

Dependencies:   mbed USBDevice

Files at this revision

API Documentation at this revision

Comitter:
cspista
Date:
Thu Jun 16 12:55:34 2022 +0000
Commit message:
Final version

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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 060ef37bda98 USBDevice.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Thu Jun 16 12:55:34 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/USBDevice/#53949e6131f6
diff -r 000000000000 -r 060ef37bda98 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jun 16 12:55:34 2022 +0000
@@ -0,0 +1,26 @@
+
+/* USBKeyboard example
+ * This program will emulate a keyboard and emits few keycodes
+ * each time when the B1 user button was pressed. 
+ *
+ * Tested on NUCLEO-F446RE board with Mbed 2
+ */
+#include "mbed.h"
+#include "USBKeyboard.h"
+
+DigitalIn SW1(BUTTON1,PullUp);
+USBKeyboard keyboard;
+
+int main(void)
+{
+    while (1) {
+        while(SW1==1) {}
+        keyboard.mediaControl(KEY_VOLUME_DOWN);
+        keyboard.printf("Hello World from Mbed USBKeyboard demo\r\n");
+        keyboard.keyCode('s', KEY_CTRL);
+        keyboard.keyCode(KEY_CAPS_LOCK);
+        wait(0.02);
+        while(SW1==0) {}
+        wait(0.02);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 060ef37bda98 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jun 16 12:55:34 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file