Learning Goals 5 min
By the end of this lesson you will be able to:
- Download and install the Arduino IDE 2.x on a Windows, macOS or Linux computer.
- Connect the Arduino UNO over USB and select the correct Board and Port from the Tools menu.
- Upload the Blink sketch onto a real board and watch the on-board LED flash once per second.
Warm-Up 10 min
Last lesson we toured the Arduino UNO board and learned that a microcontroller is a tiny brain that does one focused job. Today we wake the brain up.
Quick-fire puzzle
Two things have changed in the sketch below compared to the classic Blink. What do you think they do?
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(200);
digitalWrite(LED_BUILTIN, LOW);
delay(200);
}Reveal the answer
Change 1: LED_BUILTIN is a friendly name the Arduino IDE already knows for the on-board LED — on the UNO this is pin 13, but on other boards it might be a different pin. Using LED_BUILTIN means the sketch works on any Arduino without you needing to remember the pin number.
Change 2: delay(200) instead of delay(1000) makes the LED blink five times faster — once every 0.4 s instead of every 2 s.
New Concept 20 min
The big idea — from screen to chip
The Arduino IDE (Integrated Development Environment) is the app you use to write Arduino sketches. Think of it like a kitchen: you write the recipe (your sketch), the IDE turns the recipe into something the chip can actually eat (called compiling), and the upload button serves that meal onto the board over the USB cable.
Three steps happen behind the scenes every time you press upload:
- Compile — your readable sketch is translated into machine code the ATmega328P understands.
- Upload — the IDE sends that machine code down the USB cable to the board.
- Run — the board resets and starts running your sketch from the first line of
setup().
Where the buttons are in the IDE
Open the Arduino IDE 2.x. The most important controls live in the top-left corner and the Tools menu:
| What | Where to find it | What it does |
|---|---|---|
| Verify (✓) | Top-left toolbar | Compiles your sketch but does not upload it — useful for spotting typos. |
| Upload (→) | Top-left toolbar, next to Verify | Compiles and sends the sketch to the board over USB. |
| Board selector | Top dropdown or Tools → Board | Tells the IDE which Arduino you are talking to. |
| Port selector | Same dropdown or Tools → Port | Tells the IDE which USB socket the board is plugged into. |
| Serial Monitor | Top-right toolbar (magnifying glass) | A two-way text window for talking to the board — we use this from Lesson 23. |
| Output panel | Bottom of the window | Shows messages from Verify and Upload, including any errors. |
Every sketch has these two functions
void setup() {
// runs ONCE when the board powers on or resets
}
void loop() {
// runs OVER and OVER, forever
}Why it matters
Uploading code is the moment when "letters on a screen" become "things happening in the real world". This is the difference between programming a website and programming an Arduino — what you write tonight, you can hold in your hand tomorrow.
Worked Example 20 min
Together with your teacher, walk through these exact steps. By the end of the walkthrough every student should have the on-board LED blinking.
- Open the Arduino IDE. Wait for it to finish starting up.
- File → New Sketch — a fresh window appears with empty
setup()andloop(). - Plug the UNO into your computer with the USB cable. A green power LED should light up on the board.
- From the top board dropdown choose Arduino UNO.
- From the port list choose the USB port the board is plugged into (it will be labelled
COMxon Windows or/dev/cu.usbmodem…on macOS). - Replace the empty sketch with the sketch below.
- Press the Verify tick — the Output panel should say
Done compiling. - Press the Upload arrow — the orange RX and TX LEDs on the board flicker for a few seconds.
- Watch the orange L LED. It should now blink once per second.
// Blink — your first uploaded sketch
const int LED_PIN = 13;
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, HIGH);
delay(1000);
digitalWrite(LED_PIN, LOW);
delay(1000);
}
// → on-board L LED blinks once per secondWhat changed since last lesson? Nothing in the code — this is the same Blink sketch from ARD-L01-01. The difference is you have just uploaded it onto a real chip for the first time.
Try It Yourself 20 min
For each task, edit your Blink sketch, press Upload and watch the on-board LED. Do not move on until the LED actually does what the task asks.
Goal: Make the LED blink twice as fast as the default Blink.
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}Goal: Make the LED follow a heartbeat pattern — a quick double-blink, then a long pause, then repeat.
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
// blink twice quickly, then wait, then repeat
}Goal: Save your sketch with a meaningful name (File → Save As → my-first-blink), close the IDE, reopen it and load the sketch back. Then change the timing once more and upload again.
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(500);
}Mini-Challenge 15 min
Bring your ARD-L01-01 invention to life
Pull out the paper design of the smarter everyday object you sketched in last lesson's mini-challenge. Choose one output from your design and write a Blink-style sketch where the on-board LED simulates that output:
- If your output is a buzzer that beeps every 5 seconds, blink the LED every 5 seconds.
- If your output is a motor that runs for 2 seconds when triggered, flash the LED for 2 seconds then off forever.
- If your output is a status indicator, use a long blink for "OK" and a fast double-blink for "alert".
Upload the sketch and demo it to a partner without telling them which invention it is.
It works if your partner can describe back to you what the LED behaviour represents in your invention.
Recap 5 min
You wrote your first uploaded sketch. The Arduino IDE compiled it into machine code, sent it down the USB cable, and the board ran it the moment it finished resetting. From now on, every lesson ends with code running on real hardware.
- Arduino IDE
- The free app you write, compile and upload Arduino sketches in.
- Compile
- Translate the sketch into machine code the microcontroller can run.
- Upload
- Send the compiled machine code over USB onto the board.
- Port
- The name your computer gives the USB connection — e.g.
COM3on Windows or/dev/cu.usbmodem14101on macOS. - Sketch file (
.ino) - The file extension the IDE saves your code in. Each sketch lives in its own folder.
Homework 5 min
Three speeds of Blink. At home (or before class next week), open the Arduino IDE and:
- Create three sketches called
blink-slow,blink-mediumandblink-fast. - Upload each one and make a note of which timing values you used.
- Record a 10-second phone video of the fastest one and the slowest one.
Bring back next class: the video on your phone or a screenshot of the IDE Output panel showing the words Done uploading.