Some time ago I read a book called "C++ Common Knowledge". It consisted of a series of short 2-3 page articles, each detailing some important, but often misunderstood detail of C++. Recently, I've answered a number of Arduino/Electronics questions that seem to have this same feeling to them. This is the first in a series of short articles I'm going to call "Arduino Common Knowledge".
Today, we'll start with an idea that seems to go against all safety warnings: you can blink an LED directly off an Arduino/AVR pin. Yep, no resistors. We've probably all experienced the fun of plugging an LED in between our 5V and ground rails, and watching it glow brightly for a second before exploding and smelling quite awful -- so it seems natural we'd always want to install a current-limiting resistor to stop this problem.
But here's the interesting part: your Arduino/AVR is a current-limiting device. The I/O pins can typically only source about 15-20mA of current. Thus, if we connect our LED between the pin and ground, and toggle the pin high, our LED glows nicely without exploding.
There are a few caveats to this though: you can't do this on every pin on the AVR at the same time, or even a large number of pins. The ATMEGA168 data sheet specifies that the Absolute Maximum DC current between Vcc and GND is 200.0mA. Since the AVR core and periphrasis such as the UART/SPI/ADC draw some current of their own, we clearly can't control a huge number of LEDs this way. Also note that if we leave the LEDs on for a long time, you'll probably notice the AVR getting a bit warm sourcing that much current.
Next Up: Pull-Up Resistors (and Why You Need Them)