empowering creative people

Using Teensy with Arduino IDE

If you’ve come looking for how to get your Teensy board up and running using the Arduino IDE, then you’ve come to the right place. Whilst you can use the standard Teensy loader application to flash compiled code directly to your Teensy, most people prefer to write and upload their code straight from the Arduino IDE, taking advantage of the glorious libraries and Wiring abstraction.

If you’re not 100% sure what this ‘Teensy’ device is that we’re talking about, not to worry, just head over to our What is Teensy and Teensy Boards Compared tutorials, check them out, and head back over here to get it setup. We won’t be going into the basics of working with the Arduino IDE here, so check out our Arduino tutorials for more info on that and without further ado, let’s press on.

Installing the Teensyduino Application

The Arduino IDE doesn’t come with built-in support for Teensy devices, so Paul Stoffregen (the genius behind Teensy) created a simple application called Teensyduino which allows you to program your Teensy directly from the Arduino IDE, as well as adjust the clock speed, and USB device functions (serial, HID, MIDI etc…). So first of all, we need to download Teensyduino, you can find the download link and instructions for installation on other operating systems such as Linux and MacOS here. Follow the installation instructions there and make sure that you select the folder where your Arduino application is.

Teensyduino install setup

Plug your Teensy into your computer using a micro-USB cable, and it will automatically load up the last program that was flashed to it, by default, every Teensy ships with a ‘blink’ program on it. You pretty much don’t need to touch the Teensy loader application when using it with Arduino, it will automatically act as a gate between Arduino and your Teensy board, and unless your uploading hex files directly to your Teensy, you shouldn’t have to worry about pressing the program button on the board as mentioned in the application.

Awesome sauce, once the installer has finished if you had Arduino open, restart the application, otherwise, open it up. Now if you go to Tools>Board: and you can see the range of Teensy boards available to use. Select the board that you’re using, and in the Tools drop-down menu, you’ll see the various USB device types and clock speeds you can choose from. Let’s take a look at some of the new options for Teensy inside Arduino.

Programming Teensy with Arduino

So now the Teensyduino application has installed all of the Teensy board types and other required info in the Arduino application folder so when you load it up, your board will show up just like any other Arduino board. Teensyduino also comes with a whole bunch of extra libraries and examples to complement the existing Arduino files. So let’s write our first program for the Teensy and upload it. We’ll use an example called EchoBoth which simply echoes a response to any serial data received using the Serial Monitor. Select that example from File>Examples>Teensy>Serial>EchoBoth and make sure that you have the correct Teensy board type selected.

Teensy board selection Arduino

You can use whatever clock speed you like, however, by default, it should be on 96Mhz Optimize Speed or something similar. Ensure that you have the USB type selected as ‘Serial’. Upload your code to your board and wait for the process to complete. Sometimes, you may receive a message in the upload log prompting you to press the program button on your Teensy board, pressing it, or uploading your sketch again usually sorts it out.

After making sure the correct serial port is selected, open the serial monitor, and you can send characters, or messages and the Teensy will echo back a response:

Serial monitor echo 1

Serial monitor echo 2

Congrats! You just got your Teensy setup and uploaded your first program! Now you can use it just like you would an Arduino, however, with the extra flexibility of using the other Serial device types and power of the ARM Cortex processor. For more awesome project ideas and cool stuff you can do with your Teensy, check out our other Teensy tutorials and projects section. Happy making!

If you’ve come looking for how to get your Teensy board up and running using the Arduino IDE, then you’ve come ...

Have a question? Ask the Author of this guide today!