Based on USBKeyboardMouse example. I added USB String Descriptor so mbed reports itself to host not only with VID & PID but also with name of manufacturer, product name, serial number, configuration number and interface name. These can be changed to matching Yours in USBhid.cpp file on lines 88 - 122.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "USBMouse.h"
00003 #include "USBKeyboard.h"
00004 
00005 DigitalOut led(LED1);
00006 USBMouse mouse;
00007 USBKeyboard keyboard;
00008 
00009 int main() {
00010     while(1) {
00011         mouse.move(18, 10);     //moves the mouse down and to the left
00012         keyboard.sendKeys("mbed");     //sends the word "foo" through the keyboard
00013 
00014         led = !led;     //cycles the LED on/off
00015         wait(2);        //waits 2 seconds, then repeats
00016     }
00017 }