István Cserny / Mbed 2 deprecated Lab10_USB_kwikboard

Dependencies:   mbed USBDevice

Files at this revision

API Documentation at this revision

Comitter:
cspista
Date:
Thu Jun 16 12:59:30 2022 +0000
Child:
1:b1c07ebce303
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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/USBDevice.lib	Thu Jun 16 12:59:30 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/USBDevice/#53949e6131f6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jun 16 12:59:30 2022 +0000
@@ -0,0 +1,60 @@
+
+/* USB Keyboard extended example
+ * This program will emulate an USB keyboard and
+ * emits predefined key sequences when teh corresponding
+ * button was pressed
+ *
+ * Tested on NUCLEO-F446RE board with Arduino Multifunction Board using Mbed 2
+ */
+#include "mbed.h"
+#include "USBKeyboard.h"
+
+DigitalIn B1(BUTTON1,PullUp);
+DigitalIn S1(A1,PullUp);
+DigitalIn S2(A2,PullUp);
+DigitalIn S3(A3,PullUp);
+USBKeyboard keyboard;
+
+int B1state = 1;
+int S1state = 1;
+int S2state = 1;
+int S3state = 1;
+
+int main(void)
+{
+    while (1) {
+        if (B1state && !B1) {
+            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);
+            B1state = 0;
+            wait(1);            
+        } else if(!B1state && B1) B1state = 1;
+
+        if (S1state && !S1) {
+            keyboard.keyCode('r', KEY_LOGO);  // Windows kay + R key command
+            keyboard.printf("https://megtestesules.info\r\n ");
+            S1state = 0;
+            wait(1);            
+        }
+        else if(!S1state && S1) S1state = 1;
+        
+        if (S2state && !S2) {
+            keyboard.keyCode('r', KEY_LOGO);  // Windows key + R key command
+            keyboard.printf("https://megtestesules.info/hobbielektronika/\r\n ");
+            S2state = 0;
+            wait(1);            
+        }
+        else if(!S2state && S2) S2state = 1;        
+
+        if (S3state && !S3) {
+            keyboard.keyCode('r', KEY_LOGO);  // Windows key + R key command
+            keyboard.printf("https://cspista.hu/\r\n ");
+            S3state = 0;
+            wait(1);
+        }
+        else if(!S3state && S3) S3state = 1; 
+        wait(0.02);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jun 16 12:59:30 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file