Skip to content

Example sketches

Use this bare minimum code snippet as a starting point to initialize the HID.

minimum.ino
#include <Keyboard.h>
void setup() {
delay(5000);
Keyboard.begin(KeyboardLayout_de_DE);
// ... your code ...
Keyboard.end();
}
void loop() {
}

With this snippet, you can execute the onboard Windows Calculator (calc.exe) using a German keyboard layout.

calc.ino
#include <Keyboard.h>
void setup() {
delay(5000);
Keyboard.begin(KeyboardLayout_de_DE);
delay(500);
Keyboard.write(KEY_ESC);
delay(500);
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('r');
Keyboard.releaseAll();
delay(1000);
Keyboard.print("calc");
delay(1000);
Keyboard.write(KEY_RETURN);
Keyboard.end();
}
void loop() {
}