

It's our lowest-cost arduino-IDE programmable board! Perfect for when you don't want to give up your expensive dev-board and you aren't willing to take apart the project you worked so hard to design. It's a microcontroller board that is small enough to fit into any project, and low cost enough to use without hesitation.
#ADAFRUIT TRINKET KEYBOARD CODE#
Tip: For key combinations, each key must be "pressed" by the Arduino code in sequence using a Keyboard.press() command for each key as shown on the example code.Trinket may be small, but do not be fooled by its size! It's a tiny microcontroller board, built around the Atmel ATtiny85, a little chip with a lot of power. See the Arduino documentation for more information on the key modifiers. The first one toggles the mute button on Skype while the second one locks the screen on Windows. The program is set up to provide two keyboard shortcuts in response to a button-press: Windows-F4 and Windows-L. Once the environment is installed, start a new project, copy the code at the end of this page, select the board type, the port and upload the program. Tip: If you plan on using a non-Arduino-branded board (like the Adafruit Trinket M0 in this project), it is easier to follow the manufacturer's instructions, for example t he Adafruit Arduino IDE setup page, as they include setting up the environment with the corresponding boards and libraries. If you don't already have an Arduino environment installed, this is the time to do it. Depending on the buttons used, this can mean that either the buttons have to be tested unsoldered, or they have to be desoldered and resoldered after installation inside the case. Tip: Always test the code and wiring before starting to put the electronics inside the enclosure. If you use buttons as shown in this project that are screwed from the bottom, make sure you solder the buttons after they are in place in their respective holes. That makes it easier to attach the wires to the legs and greatly simplifies soldering. Most buttons have small holes in their legs. I suggest soldering the wires to the Trinket from the top (as shown on the picture below) so that there is no clearance issue at the bottom. The connections are shown on the fritzing diagram at the bottom of this page. There are just 7 solder joints to make on this project. Tip: I recommend using solid core wires for this project as they are easier to solder and work with and they will not be exposed to repeated flexing. The enclosure will need to have a hole cut to insert the USB plug. The Trinket must be very solidly mounted to the enclosure to sustain the high stress of USB cable insertion. Do not buy buttons that need to be soldered to a board.


It can be replaced by pretty much any of the other Atmel ATSAMD21-based boards like the Arduino MKR ZERO or the SparkFun SAMD21 Mini Breakout. The key component for this project is the Adafruit Trinket M0. It saves me from having to reach for the keyboard or remembering keyboard shortcuts.

This is a very simple, yet useful introductory project to Arduino, USB and buttons.
