You are viewing an older revision! See the latest version

USBMouseKeyboard

Beta only!

This library is in beta, and only works with the betamode compiler and the beta libraries.

To use these, ensure you have enabled /betamode for the compiler, and that you import these examples as the basis for your experiments to ensure the beta mbed library is pulled in.

The USBMouseKeyboard interface is used to emulate a mouse and a keyboard at the same time over the USB port.

USB pins are available on p31 (D+) and p32 (D-)

Hello World

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

USBMouseKeyboard key_mouse;

int main(void) {
    while (1) {
        key_mouse.mediaControl(KEY_VOLUME_DOWN);
        key_mouse.printf("Hello World from Mbed\r\n");
        key_mouse.keyCode('s', KEY_CTRL);
        key_mouse.move(20, 0);
        wait(1);
    }
}

Import programUSBMouseKeyboard_HelloWorld

USBMouseKeyboard Hello World

API

[Not converted]

Details

You can choose either a relative mouse or an absolute mouse with the keyboard. By default, a USBMouseKeyboard is a relative mouse and a keyboard


All wikipages