Pro Mini blink
The 5 V Pro Mini running the Nano’s blink on an LED on pin 13: the same chip and the same image, on the smallest Arduino there is. The whole build, an Arduino Pro Mini and 2 more parts, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.
Teaching? Assign it to your class in one click.
Beginner About 10 minutes to build and run. Runs in your browser. Free, and no account needed.
The parts retail for about $9.15. On Mokxi they're free.
What you'll learn
- Switching a pin on and off
- LED_BUILTIN as a name for pin 13
- Timing with delay
- Why an LED needs a series resistor
- Difficulty: Beginner
- Time: About 10 minutes
- Board: Arduino Pro Mini, 5 V 16 MHz
- Parts: 4
How it works
Pin 13 feeds the green LED through a 220 ohm resistor, and the LED's other leg goes to GND. The sketch switches pin 13 HIGH, waits half a second, switches it LOW, and waits again.
Pin 13 is also the board's built-in LED pin, so LED_BUILTIN means 13 here, the same as on an Uno. The Pro Mini runs at 5 V and 16 MHz.
Parts list
4 parts, plus the jumper wires. They retail for about $9.15; on Mokxi they're free.
- 1 × Arduino Pro Mini, 5 V 16 MHz
- 1 × Full-size breadboard
- 1 × Resistor, 220 ΩIn Starter Kit, Claw Machine Kit, Halloween Prop Kit.
- 1 × LED, greenIn Starter Kit, Halloween Prop Kit, Logic Lab Kit.
Wiring table
Every connection, pin by pin, read from the circuit itself. Each row joins the pin on the left to the pin on the right, by a jumper wire or a breadboard strip.
| Part and pin | Connects to |
|---|---|
| LED, green pin C | Arduino Pro Mini, 5 V 16 MHz pin GND |
| Resistor, 220 Ω pin 1 | Arduino Pro Mini, 5 V 16 MHz pin 13 |
| LED, green pin A | Resistor, 220 Ω pin 2 |
The code
The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.
// Blink: the smallest thing a board can do.
//
// Pin 13 has the LED soldered beside the USB socket on a Nano exactly as it is
// on an Uno, so LED_BUILTIN is 13 here too. The Nano pushes into a breadboard,
// so an LED and a 220 ohm resistor from pin 13 to the ground rail take no
// jumper wires at all.
//
// delay() puts the chip to sleep between timer ticks rather than spinning, so
// this sketch costs the simulator almost nothing while it waits.
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}
Code walkthrough
The key functions of the sketch, and what each one does.
setup sketch.ino
Runs once. It calls pinMode to make LED_BUILTIN (pin 13) an output.
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}loop sketch.ino
Sets the pin HIGH, waits 500 ms with delay, sets it LOW, and waits another 500 ms. The loop then starts again, so the LED blinks once a second.
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}Troubleshooting
The usual mistakes with this circuit, and the fix for each.
- The LED never lights. This project
Check its direction. The anode (A) goes to the resistor from pin 13, and the cathode (C) goes to GND. - The blink is the wrong speed. This project
Change the two500values indelay. They are in milliseconds. - The LED is dim, burns out, or the pin reads wrong because the resistor value is off. Resistor
Read the color bands again. A 220 ohm to 330 ohm resistor suits a typical LED on 5 V. 10k is a common pull-up or pull-down value. Check with a multimeter if unsure. - A pull-up or pull-down resistor is missing, so the input floats and reads random values. Resistor
Tie the input to 5 V or ground through about 10k. Or use INPUT_PULLUP and wire the switch to ground. - The LED does not light, or it lights once and then dies. LED
LEDs have polarity. The longer leg (anode) goes toward the positive side. Always add a series resistor, about 220 ohms to 1 k ohm on a 5 V pin. - A blue or white LED stays dark on 3.3 V. LED
Blue and white LEDs drop about 3 V, so 3.3 V leaves almost nothing for the resistor. Use a 5 V supply, or a smaller resistor and a red or green LED. - The upload fails or the board will not respond. Arduino Pro Mini
The Pro Mini has no USB. Use an FTDI or USB serial adapter set to 5 V, connect DTR to the reset line through a capacitor, and choose the Pro Mini 5 V 16 MHz board in the IDE. - The board runs wrong or is damaged. Arduino Pro Mini
Match the board version: a 5 V 16 MHz model must get 5 V on VCC (or 5 to 12 V on RAW). Do not feed a 3.3 V model 5 V. A0 to A5 and the pins work as on an Uno.
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.