Arduino UNO
What you’ll learn
- What a microcontroller is and what’s on an Arduino UNO
- What each group of pins does
- How to install the Arduino IDE and upload the Blink example
What is an Arduino?
Arduino is a family of microcontroller boards plus free software to program them. A microcontroller is a tiny computer on one chip that runs one program, forever, from the moment it gets power. It reads sensors through its input pins and controls LEDs, motors and buzzers through its output pins.
The UNO is the classic beginner board. You’ll see a few versions:
| Board | Notes |
|---|---|
| UNO R3 (and most clones) | The classic. Huge number of tutorials. |
| UNO R4 Minima / R4 WiFi | Current official boards, same shape and pin layout. R4 WiFi adds Wi-Fi, Bluetooth and an LED matrix. |
| Nano | Same idea, much smaller, plugs into a breadboard. |
Everything in this course works on any of them.
A tour of the board
| Part | What it’s for |
|---|---|
| USB port | Power from your computer and uploading programs |
| Barrel jack / VIN | Power from a battery, 7–12 V recommended |
| Digital pins 0–13 | On/off inputs and outputs. Pins marked ~ (3, 5, 6, 9, 10, 11) can also do PWM, a fake “in-between” output for dimming and motor speed |
| Analog pins A0–A5 | Read voltages between 0 and 5 V, for sensors like knobs and light sensors |
| 5V and 3.3V pins | Power small sensors and modules (not motors!) |
| GND pins | Ground, the 0 V reference. Every circuit connects back here |
| Built-in LED “L” | Connected to pin 13; great for testing |
| Reset button | Restarts your program from the beginning |
Install the Arduino IDE
The IDE (Integrated Development Environment) is the free app where you write code and send it to the board.
- Download Arduino IDE 2 from arduino.cc/en/software and install it.
- Plug the UNO into your computer with a USB cable that carries data. Some cables are charge-only and won’t work. The green ON LED should light.
- At the top of the IDE, open the board/port menu and pick your board and port. The port is named like
COM3on Windows or/dev/cu.usbmodem…//dev/cu.usbserial…on Mac. - UNO R4 only: if asked, install the Arduino UNO R4 Boards package (Tools → Board → Boards Manager).
- Open File → Examples → 01.Basics → Blink.
- Click Upload (the → arrow). Wait for “Done uploading”.
What you should see
The orange L LED on the board blinks: 1 second on, 1 second off, forever. Unplug and replug the board: it starts blinking again by itself, because the program is stored on the chip.
If the upload fails
| Problem | Fix |
|---|---|
| No port appears | Try another USB cable (data, not charge-only) or another USB socket |
| Clone board not detected | Many clones use a CH340 USB chip; install its driver if your computer doesn’t recognise it |
| “Wrong board” or upload errors | Check the board selected in the IDE matches your actual board |
| Port is busy | Close other programs using the board (like a second IDE window) |
Example: Blink, slower
void setup() { pinMode(LED_BUILTIN, OUTPUT);}
void loop() { digitalWrite(LED_BUILTIN, HIGH); delay(2000); // on for 2 seconds digitalWrite(LED_BUILTIN, LOW); delay(500); // off for half a second}Example: a heartbeat
void setup() { pinMode(LED_BUILTIN, OUTPUT);}
void loop() { for (int i = 0; i < 2; i++) { // two quick beats digitalWrite(LED_BUILTIN, HIGH); delay(100); digitalWrite(LED_BUILTIN, LOW); delay(150); } delay(800); // then a pause}No board yet? Use the virtual Arduino
The simulator below is a virtual UNO. Start it, replace the code in sketch.ino with the Blink code below, and press the green ▶ button. The little LED marked L on the virtual board will blink.
void setup() { pinMode(LED_BUILTIN, OUTPUT);}
void loop() { digitalWrite(LED_BUILTIN, HIGH); delay(1000); digitalWrite(LED_BUILTIN, LOW); delay(1000);}Runs on Wokwi, free, no account needed.
Faster blinkEasy
Make the built-in LED blink 4 times per second.
Each blink is on + off, so use delay(125) for both: 125 + 125 = 250 ms per blink.
SOSMedium
Blink · · · — — — · · · (short = 200 ms, long = 600 ms, 200 ms gap) and then pause 2 s.
Write a small function void flash(int ms) that turns the LED on for ms, then off for 200 ms.
Show an answer
void flash(int ms) { digitalWrite(LED_BUILTIN, HIGH); delay(ms); digitalWrite(LED_BUILTIN, LOW); delay(200);}
void setup() { pinMode(LED_BUILTIN, OUTPUT); }
void loop() { for (int i = 0; i < 3; i++) flash(200); for (int i = 0; i < 3; i++) flash(600); for (int i = 0; i < 3; i++) flash(200); delay(2000);}Two LEDs taking turnsHard
In the simulator, add a second LED with a resistor on pin 9 and make the two LEDs blink alternately.
Show an answer
void setup() { pinMode(LED_BUILTIN, OUTPUT); pinMode(9, OUTPUT);}
void loop() { digitalWrite(LED_BUILTIN, HIGH); digitalWrite(9, LOW); delay(400); digitalWrite(LED_BUILTIN, LOW); digitalWrite(9, HIGH); delay(400);}Quick check
Finished this lesson?