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

main.cpp

Committer:
GregC
Date:
2015-12-31
Revision:
0:92846b9895f1
Child:
1:a5ca446fb520

File content as of revision 0:92846b9895f1:

#include "mbed.h"
#include "USBMouseKeyboard.h"

DigitalOut led(LED1);
USBMouseKeyboard key_mouse;

int main(void) {
    while (1) {
        key_mouse.move(60, 0);
        key_mouse.doubleClick();
        key_mouse.keyCode(KEY_CAPS_LOCK);
        key_mouse.printf("hello world from frdm-k64f. \n");
        wait(2);
        key_mouse.move(-60, 0);
        key_mouse.doubleClick();
        key_mouse.keyCode(KEY_CAPS_LOCK);
        key_mouse.printf("hello world from frdm-k64f. \n");
        led = ((key_mouse.lockStatus() & 0x2) >> 1); /* second bit is caps lock */
        wait(2);
    }
}