Teensy for beginners (like me) – first step

Teensy 2.0 on desktopRecently I bought something called Teensy 2.0. I’m still not sure why would I need it, but I will figure it out soon. What is Teensy? It is small USB Development Board that could be programmed as USB HID recognized by PC (so it can pretend to be keyboard or mouse).
I’m not an expert in such stuff, so it is new challenge to learn how to do something with it.

So what to do with such board? First thing may be to try to plug it in into USB port – if this new board, then build in LED should start blinking. But after few seconds of watching LED it gets boring.

teensyTo do something more, we need some way to upload new programs into board. For windows we can use Teensy Loader – small exe that works not only on Vista, but also on Windows 8. Usage is also simple:

    • Plug board to USB port
    • Press small button on Teensy board (it is activating HalfKay loader – program that allow loading program to user memory on board)
    • Open .hex file with program (I will move back to this point later)teensy2
    • Load hex file on board
    • Reboot board to start program (it is the same if you unplug and then plug again board). There is also option to automatically reboot board after loading program).

 

So how to get hex file that could be loaded on board? You can download some examples from same site where teensy.exe is located. These programs mainly operate on onboard led. So they also quickly became boring.

To write your own program you would need compiler. For Windows you can use WinAVR. It might be good idea to install it in directory without spaces. For easier use, you might agree to add it to PATH system variable. If you are using x64 OS (and now days most likely you do), you might to update msys-1.0.dll (if you don’t do it, you will get errors during compilation time). To do that go to MadWizard website, find link to msys-rebased.zip file, and replace dll in compiler directory with the one in zip file.

Having a compiler, you can compile first code. You can download example with mouse usage and unpack it. In directory with source code, press shift and right mouse button, then select „Open command windows here”. To run compiler, type make and press enter. If everything will go fine, you will see new example.hex file. When you load it to Teensy, your mouse will start moving. Now that’s became interesting.

In next post I will try to show some more interesting usage of this board.