I recently became aware of the Arduino development platform, and about the same time, another little device called the Teensy. Since then my 'entertainment budget' has been funneled into the bank account of SparkFun for various transistors, switches, regulators, and the all-important LEDs; and of course to PJRC for a Teensy... but just what is a Teensy?
The result of a project by Paul Stoffregen, the Teensy is a microcontroller development board based on the Atmel AT90USB162 AVR. The Arduino, also based on Atmel AVRs, differs from the Teensy in a few important ways:
So why Teensy; why didn't I go with the more popular Arduino? There are a lot of reasons I could state, but what it comes down to are two very important ones.
"What? The Arduino has a huge community!" Yes, yes it does... and when I bought my Teensy I didn't know ANY OF THEM. I did, though, know someone that had a Teensy. A community of two is much more useful than one of thousands when you know each other personally, and can just show up on the other's doorstep at any time. I'm a visual learner; five minutes of watching someone else do something is worth weeks of reading about it for me, so having someone in my own little part of the world I could compare notes with if needed played a huge part in my decision.
The best part is I am not separated from the very large and very active Arduino community. Paul is actively developing what he calls Teensyduino, a plugin for the Arduino IDE that lets most Arduino sketches (the source code for controlling an Arduino, so named because it's based off the Processing programming language whose IDE is called a sketchbook) run with only a little modification. So I get the small form factor, faster communications if I needed it, a local fellow developer, and most of the resources of the Arduino development community for $22 ($19 if you get it without header pins). That's a cost of entry I can deal with.
Of course, it hasn't been all happiness and sunshine. Teensyduino is still in early beta, so some sketches aren't as easy to make work as I'd like just yet. I recently ran into a small issue with serial communications. Specifically the Serial.available() function. Per the Arduino website, it should return the number of characters waiting in the buffer to be read. As I don't have an actual Arduino to test the code on I can't be sure, but the example code agrees with the description. On the Teensy (at least as of Teensyduino v0.4) it returns something else, though I'm not sure just what the number means. So I had to come up with a far less elegant solution... the conversation went something like this:
Me:
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
Serial.println(Serial.read(), DEC);
}
}
Teensy:
-1
Me: That shouldn't be happening, -1 means there's no data to read if there is no data Serial.available() should be 0, and you shouldn't be reading.
Teensy: Whatever...
Me: Don't give me any lip, I'll reflash you, and do something else.
Teensy: As if, you're my beotch, and you'll do what I say now.
Me:
int receivedByte = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
receivedByte = Serial.read();
if (receivedByte >= 0) {
Serial.println(char(receivedByte));
}
}
Teensy: I don't have anything to show you... you need to send me something.
Me: HA!
Teensy: Curses, foiled again!
Yes, that's pretty much how it went... or at least that's how it went in my head. I blame Wil Wheaton... and his iTunes.
So that's what I've been up to. That work has even fallen over into my still not released write up on GeekTool, which will be out by the end of this week. I just keep finding other things to put in it, so it's never actually done. I guess it's time for a 'feature freeze'.