Set up a new project and import the required libraries

Make a new program in your compiler, and choose "Empty Program" as a template.


Import USBDevice

Click "Import" and search for "USB" -> double click "USBDevice"


Import mbed

On some platforms, the mbed library is missing when you create a new project. Do the same thing as for USBDevice, but search for "mbed" and choose the library created by "mbed official".

Create a .cpp file

Create a new .cpp file in the project

Copy pasta

Here's a small program to get you started. Just copy the code below into the .cpp file you created and you're ready!

#include "mbed.h"
#include "USBKeyboard.h"

DigitalOut mled(LED1);

USBKeyboard keyboard;

int main(void) {
    //Loop forever
    while (1) {
        //Wait 1 second


        //Write some text
        keyboard.printf("Hello World from Mbed\r\n");

        //Toggle LED to show that it's running
        mled = !mled;

To become a keyboard, you need another cable!

Compile the program and flash the microcontroller by saving the file directly onto it (see mbed setup).

Now you need another USB cable. On the EFM32 boards, the USB you should use is the micro USB port. If you connect this one to your computer, it should now pretend to be a keyboard and spam text. Protip: Open notepad or similar before you plug in the "keyboard".

If you flip the switch on the bottom left of the board to USB (from AEM/DBG depending on the board), the board will switch to a mode where it powers itself from the micro USB cable directly (instead of the debug cable). Then you will only need one cable to use the keyboard.

Suggestions for further development

Try to use the buttons on the board, and other input, to simulate keystrokes. For instance, you can create your own volume control.