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
Hey guys, how’re you going? It’s Sam here from Core Electronics and today we’re going to be taking a look at how we can use the Teensy Board with the Arduino IDE. Now if you’re not sure what Teensy is then go and check out some of our other tutorials which cover what the Teensy Board is, a few of the different models of Teensy and their functionality but one of the really really cool things if you didn’t know is that they’re extremely powerful microprocessor boards, really really small running Arm Cortex processors that are compatible with the Arduino IDE. This means that you get the power of Arm Cortex processors - you know if this guys is running at 96 mHz, stacks of eeprom flash, ram, heaps and heaps of awesome specs in a tiny little compact package which is compatible with the wiring abstraction found in Arduino. So if you’re not sure what Arduino is or the IDE or the programming language we’re not going to cover that today. Check out our other Arduino tutorials. Today we’ll look at installing the Teensyduino loader application and writing our first program onto the teensy board.
In our Tutorial, in the content there’s a link to where you can download the Teensyduino Application. This application acts as a gateway between the Arduino IDE and your Teensy board. It takes the compiled code from Arduino and ports it over on to here. The Teensy board just has a micro USB connector similar to many of the Arduino Boards or rather other consumer electronics so all you’re going to need is a micro USB cable and your Teensy Board.
I’ve got the 3.2 here but the Teensy LC, the 3.5, the 3.6, all the current gen models or any of the older models as well will work just fine. So follow the link there - it’s available for Windows, Mac, Linusalright as well with a few variations in the steps that you might need depending on the operating system you’ll be using them with but for the most part you simply download the application, install it, tell it where your Arduino program files are - so if you’re in Windows it’ll be in your C drive, program files, and away you go!
So go ahead and download that, we’ve already got it downloaded and configured and you’ll get a couple of screens like a typical installer so just click next next and make sure that’s where your Arduino files are when it comes to it. This is going to install the board profiles onto the Arduino IDE along with some of the core libraries for the Teensy because if you plug it in without installing this and go to select any boards it won’t come up.So now we’ve got it installed plug your Teensy into the computer - now the Teensy by default will start running whatever program was on it last, that’s the same with most microcontrollers. N ow if it’s a new out of the box Teensy it’s going to run a blink program, so the onboard LED is going to blink, now that’s on PIN 13 - just the same as an Arduino UNO it’s designed to be really compatible - otherwise I think I’ve already go a different project loaded up onto here which is why it’s not loading. Let’s go ahead and open up the Arduino IDE, alright, so we’ve just downloaded it and you want to close the Arduino IDE before you install the Teensy loader application then open it up again when all that stuff - you know that you can select will be in there. You’re going to want to restart it.
Alrighty let’s go create new, create a new project and now if we go into tools and board you’ll see Teensy Board is here. So 3.6, 3.5, 3.2/3.1, 3.0, Teensy LC, Teensy ++2.0, Teensy 2.0 - pretty much the current gen models plus some of the last gen models to maintain some backwards compatibility.
I want to select Teensy 3.2 because that is what I will be using and from here it’s pretty much as straightforward as loading a sketch up with an Arduino Board. So we want to go file, let’s find an example, so let’s use the echo serial example. You’ll notice that there is a Teensy folder for examples now, some that show some of the functionality that is awesome with Teensy and is probably unique to Teensy that some of the other Arduino boards don’t have. There’s not tutorials or examples on those. So serial, echo both - now this is a really simple program (didn’t even need to open up a new app) that is designed to echo whatever is coming through the serial port from one device to the other - so we can just double check that your boards loaded up, now you’ve got here USB type and this is important because Teensy Boards are so cool because they can operate as different USB device types. Just a standard serial port which you would use as a regular Arduino, they can operate as a midi device or as a hid device like a key board or a midi controller, a joystick, flat simulated gamepads, anything you like plus combinations of those but for now we just want serial. You’ve got different CPU speeds so just processor clock speeds here,pretty much the default will go to 96 mHz optimized speeds overclock. Overclock isn’t anything scary here it - it’s just a quick speed that the Teensy Board can run at and it’s going to be perfectly fine, you’re not going to damage your board. It can go up to 120 mHz right down to 2 mHz I believe, only with special USB types - but stick with 96 and you’ll be fine.Select the port, now I think this is COM port 4 - it will tell us if not, and that’s all we need to do, so when we click upload it will compile our code and it will open up a little window as you’ll see in a moment for the Teensyduino application. So, wait for it to finish compiling - now when you are uploading it via Teensy just sometimes on very rare occasions you’ll get a little message in the black text area of the IDE saying the Teensy did not reset automatically or something to that effect and that’s because (Ah, there you go! so we just uploaded) but that’s because the Teensyduino Application is resetting the Teensy which is required to upload new code to it. Sometimes something just goes wrong, usually it can be fixed by just hitting re upload again. Now this is the Teensyduino loader window - you actually don’t need to touch anything in here. You can use it, you can upload hex and binary files into that to upload directly to your Teensy Board so bypassing the Arduino IDE but otherwise it will just pop up when you click upload, flash a few times - you don’t really need to worry about it.
Now I’, just going to add our serial monitor - Ah, ok, so I had the wrong COM port selected, it’s always best to double check even if you think you know which one it is so just double check otherwise your serial monitor is not going to work. So, tools, now the one that disappeared was 19 - I unplugged it so it stands to reason that our Teensy is on Com Port 19 - now serial monitor - alright so it’s operating at 9600 Board which is what we’ve set in our code. Now I can type any character into here, so let’s say a ‘G’ and it’s going to return, it’s going to echo that character. Now G on the asc2 table is 103 - character 103 so it’s echoing 103. F would be 102, E 101, D 100, etc etc.
So that’s our first program on to our Teensy - you saw how easy it is! You load up the Teensyduino, sorry install the Teensyduino Application onto your computer and it just interacts with Arduino - it’s super super easy which is awesome.
That’s all for today guys, check out some of our other Teensy tutorials, our project section for some awesome project ideas and we’ll see you in the next tutorial.