Monday, November 12, 2012

Teensyduino Setup

[edit June 25, 2013 - forgot an important step! The Teensyduino software is not, by default, an executable file! See the new step #14 for more.] and make this *really* easy.

Getting started with the Teensy Board. I'm running Linux and using a Teensy 2.0, so these directions occasionally need minor tweaks for other operating systems or boards.
  1. Get everything ready. Make sure you have all the right hardware and that you know which drivers you need.
  2. I'm using Linux, so I open a terminal and use this command:
  3. uname -a
  4. Check the results of that command for the kernel version (mine is 2.6.32). If your result does not begin with 2.6, you're using an old kernel and may not be able to proceed.
  5. Also check those results to confirm whether you're on a 32 or 64 bit system. My uname -a says "x86_64," so I know I'm using a 64 bit system. My system at home returned "i686", which means I was using a 32 bit system.
  6. Download the appropriate Arduino software for your machine.
  7. Unpack the software. Here's the command I run from my home directory:
  8. tar -xvf ~/Downloads/arduino-1.0.2-linux64.tgz
  9. Sometimes the Linux installers include a program called brltty, which makes the Arduino software not work. Remove this program with the following command (in Linux):
  10. sudo apt-get remove brltty
  11. Now, there will be an arduino folder in your home directory (mine is at:  ~/arduino-1.0.2)
  12. Run the arduino software to make sure it works.
  13. ~/arduino-1.0.2/arduino
  14. Close the arduino software, so you can install some extra files to make it work for the Teensy board.
  15. Download the Teensyduino software that's right for your machine. 
  16. Linux users should also save this to file as "49-teensy.rules" -- my machine tries to be helpful and name it "49-teensy.rules.text", which gives you extra steps later on, so avoid this or rename it after you download it if you have to.
  17. Linux users will likely need to update the udev rules. Use this command (from the directory where the 49-teensy.rules file is:
  18. sudo cp 49-teensy.rules /etc/udev/rules.d/
  19. Make the Teensyduino software executable! You can checkout chmod if you're not familiar with it to make sure this is how you want to do it. Run the chmod command in the folder where you installed the Teensyduino software.
  20. chmod 755 ./teensyduino.64bit
  21. Run the Teensyduino Installer
    1. Choose where your sketchbook (Teensyduino code) should go
    2. Install libraries (I install all of them)
    3. When it's finished, click "Done."
  22. Run your arduino software again (step #9)
  23. Choose your board: Tools --> Board --> Teensy 2.0
  24. I'm using my Teensy board as a USB Keyboard, so I choose that USB Type from the Tools menu as well. 
  25. Tools --> USB Type --> Keyboard + Mouse + Joystick
  26. Confirm that you've got the right keyboard language: Tools --> Keyboard Layout --> US English
It's a good idea to start with a simple program like "Blink" to make sure the code compiles correctly and that the board is being flashed correctly.

The example code can be really useful. The program I needed was simple, so I just chose example code, altered it a little and now the board does exactly what I need it to!

To run example code:
  1. Start up your arduino software as usual (step #9). 
  2. Then, choose File --> Examples --> Teensy --> choose something! I started with USB Keyboard --> Simple
  3. Click the "Verify" button (it looks like a checkmark)
  4. Load it to the board (which, obviously, needs to be plugged in. . .) with the button that looks like an arrow pointing to the right. 
  5. It usually runs the newly-installed program right away, but if it doesn't, you can unplug the Teensy (after it's completed its flash/reboot) and plug it back in to get it to run the program.

I also recommend checking out Arduino's site for more "How-To"s. They've done a great job!

No comments:

Post a Comment