Application using FRDM-K64F board to emulate USB keyboard. When one of two buttons (present on the board) are pressed, predefined text is printed (as if it was input with a keyboard).

Dependencies:   USBDevice mbed

Fork of frdm_USB-HID-Mouse-Keyboard_auto by FRDM-K64F Code Share

Committer:
GregC
Date:
Thu Dec 31 17:24:55 2015 +0000
Revision:
0:92846b9895f1
Child:
1:a5ca446fb520
USB HID Mouse/Keyboard Example for Freedom boards

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GregC 0:92846b9895f1 1 #include "mbed.h"
GregC 0:92846b9895f1 2 #include "USBMouseKeyboard.h"
GregC 0:92846b9895f1 3
GregC 0:92846b9895f1 4 DigitalOut led(LED1);
GregC 0:92846b9895f1 5 USBMouseKeyboard key_mouse;
GregC 0:92846b9895f1 6
GregC 0:92846b9895f1 7 int main(void) {
GregC 0:92846b9895f1 8 while (1) {
GregC 0:92846b9895f1 9 key_mouse.move(60, 0);
GregC 0:92846b9895f1 10 key_mouse.doubleClick();
GregC 0:92846b9895f1 11 key_mouse.keyCode(KEY_CAPS_LOCK);
GregC 0:92846b9895f1 12 key_mouse.printf("hello world from frdm-k64f. \n");
GregC 0:92846b9895f1 13 wait(2);
GregC 0:92846b9895f1 14 key_mouse.move(-60, 0);
GregC 0:92846b9895f1 15 key_mouse.doubleClick();
GregC 0:92846b9895f1 16 key_mouse.keyCode(KEY_CAPS_LOCK);
GregC 0:92846b9895f1 17 key_mouse.printf("hello world from frdm-k64f. \n");
GregC 0:92846b9895f1 18 led = ((key_mouse.lockStatus() & 0x2) >> 1); /* second bit is caps lock */
GregC 0:92846b9895f1 19 wait(2);
GregC 0:92846b9895f1 20 }
GregC 0:92846b9895f1 21 }