This project is part of the Teensy LC Challenge

Teensy Project 002: HID USB Keyboard

Checkout the source code on Github.

Teensy Setup

The environment setup section is common to all the Teensy LC projects, so I created a single post with the required instructions to set up the Arduino IDE, Teensy Loader application, Teensyduino and Linux udev rules.

If you have not setup your Teensy LC yet, please go to the complete setup guide


First things first: what is an HID?

HID or a human interface device is a way of which humans interact with machines, mainly sending input from humans to the machine and most of the time receiving an output that humans can understand, in this article we are mainly concerned with the USB HID class.

USB Keyboard

Start by loading the Simple USB Keyboard example from the Teensy library or use the .ino Arduino sketch from the Teensy LC Challenge Github repository.

Make sure you select the correct type of USB from Tools > USB Type, which should be selected as Keyboard as shown in this screenshot,

Arduino Tools USB Keyboard

Please note that once the program is uploaded to the Teensy it will start writing as a USB keyboard, double check your cursor location so it doesn’t write or overwrite any important text.

Once the program is running you will start getting text as input from the USB HID Keyboard that is being emulated from Teensy LC, the output will be similar to the text below with 5 seconds delay between each new line,

1
2
3
4
Hello World 0
Hello World 1
Hello World 2
Hello World 3

References

PJRC’s USB Keyboard page


This post is still a work in progress, I’m working on adding more examples with real life impact.

As always feel free to comment, suggest or ask anything below.