István Cserny
/
Lab10_USB_keyboard
USBKeyboard "Hello world" example (LEDs setting removed as we don't have LEDs)
Revision 0:060ef37bda98, committed 2022-06-16
- Comitter:
- cspista
- Date:
- Thu Jun 16 12:55:34 2022 +0000
- Commit message:
- Final version
Changed in this revision
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