Make that LED Go “Blink”
I’m sure you’ve made your Arduino blink an LED
before, probably using the example sketch — the built-in
LED on pin 13. Of course, on this board we don’t have an
LED on pin 13 — so let’s add one.
At this point, I learned one of the most important
lessons of my transition away from the Arduino: Pin 13 on
the microcontroller is not the same as the pin labelled
“ 13” on the Uno. I connected my LED to pin 13 on the
microcontroller, fired up the sketch, and ... nothing. Not a
flicker. A whole lot of research later, I found that “ 13” isn’t
always “ 13” — unlucky!
The datasheet on the ATmega328P labels the function
of the pins pretty cryptically, so I created a quick cheat
sheet to work off of in my projects (Figure 11). This
“maps” the actual pin numbers on the ATmega328P
(which you’ll see run sequentially around the chip) to the
Uno pin numbers (in square brackets).
From this, we can see that the Uno’s pin 13 is actually
the microcontroller’s pin 19. Carefully count your way
around to pin 19, and then connect your LED as you
March 2015 43
FIGURE 10. Ready
to go: The FTDI
board connected to
FIGURE 11. Mapping the Arduino pin numbers
with the ATmega328P pins.
FIGURE 12. The Arduino blink sketch to upload.
BT1 7V+ Battery with Clip and Leads
C1 100 μF 16V+ Aluminium Electrolytic Capacitor
C2 10 μF 16V+ Aluminium Electrolytic Capacitor
C3 22 pF Ceramic Capacitor
C4 22 pF Ceramic Capacitor
C5 0.1 μF Ceramic Capacitor
U1 Linear Voltage Regulator 5V (e.g., L7805/LD1085V50)
D1 Red LED 20 mA
R1 330 ohm Resistor, 0.25W
R2 10K ohm Resistor, 0.25W
X1 16 MHz Crystal
IC1 ATmega328P-PU Microcontroller