Courses / Level 0 · Foundations / Module A · Meet the microcontroller

Arduino IDE setup and Blink: your first sketch

Class 2 ⏱ 40 min Before this: What is a microcontroller?

Install the Arduino IDE, connect your board and upload your first program to blink the built-in LED.

Beginner desk setup with board, breadboard and laptop

You'll learn

  • Installing Arduino IDE 2 and the ESP32 board package
  • Selecting board and port
  • Structure of a sketch (setup() / loop())
  • pinMode, digitalWrite, delay
  • Verify vs upload
  • Basic upload troubleshooting

What you need

ItemQtyTypeShop
Arduino Nano ESP32 (with headers)1Part—
USB-C data cable (data-capable, not charge-only)1Tool—
Computer: Windows 10/11, macOS 11+, or Linux, with admin rights to install software1Tool—
Internet connection (≈ 500 MB download for IDE + board package)—Tool—
Arduino IDE 2.xfree, arduino.cc/en/software—Software—
"Arduino ESP32 Boards" package (by Arduino), installed via Boards Manager—Software—
USB-C adapter if your computer only has USB-A (or vice versa)Optional1Tool—

Items not in the shop yet are listed as text, so you can source them anywhere.

Lesson

1. Welcome (≈1 min)

Welcome back! Last class we met the microcontroller. Today, we make it do something. In programming, the first thing you ever write is called "Hello World". In electronics, our Hello World is making an LED blink. It sounds small, but once you can blink an LED, you've proven the whole chain works: software installed, board connected, code uploaded, hardware responding. Everything else in this course builds on that.

Install → connect → select → write → verify → upload → watch
Install → connect → select → write → verify → upload → watch

Here's the plan: install, connect, select, write, verify, upload, and watch.

2. Install the Arduino IDE (≈5 min)

The IDE, or Integrated Development Environment, is the app where we write code and send it to the board. It's free.

3. Install the board package (≈4 min)

Out of the box, the IDE doesn't know about every board, so we add support for ours.

4. Connect and select (≈4 min)

Now tell the IDE which board and which port:

  1. At the top of the IDE, click the Select Board dropdown.
  2. Choose the entry that says Arduino Nano ESP32, or click "Select other board and port", search "Nano ESP32", and pick the port it's on.
  • Windows shows ports like COM3 or COM5.
  • macOS shows something like /dev/cu.usbmodem….
  • Linux shows /dev/ttyACM0.

Not seeing it? Nine times out of ten it's a charge-only cable. Swap cables first. Then try a different USB port, and avoid unpowered USB hubs.

5. Write the code (≈5 min)

The Blink code and what the pin voltage does
The Blink code and what the pin voltage does

Click File → New Sketch. A program in Arduino-land is called a sketch. You'll see two empty blocks already there, setup and loop. Delete what's there and type this in. We'd really encourage typing it rather than pasting; your fingers learn the shapes.

// Class 2 — Blink: the Hello World of electronics
// Board: Arduino Nano ESP32

void setup() {
 pinMode(LED_BUILTIN, OUTPUT); // set the built-in LED pin as an output (runs once)
}

void loop() {
 digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (pin goes to 3.3 V)
 delay(1000); // wait 1000 milliseconds = 1 second
 digitalWrite(LED_BUILTIN, LOW); // turn the LED off (pin goes to 0 V)
 delay(1000); // wait another second
}

Let's read it like English:

  • Anything after two slashes is a comment: notes for humans. The board ignores them.
  • setup() runs once, when the board powers on or resets. We use it to get things ready.
  • pinMode(LED_BUILTIN, OUTPUT) says "this pin will send power out". LED_BUILTIN is a nickname for the pin the built-in LED is wired to, which is D13 on this board. The LED itself sits right next to the USB port.
  • loop() runs over and over, forever.
  • digitalWrite(..., HIGH) turns the pin on, which is 3.3 volts. LOW turns it off, zero volts.
  • delay(1000) pauses for 1000 milliseconds, one second.

Two small details trip up everyone: every instruction ends with a semicolon, and capital letters matter. digitalwrite with a small "w" will not work.

6. Verify and upload (≈4 min)

  1. Click the tick (Verify). The IDE checks and compiles your code into something the chip understands. Look for "Done compiling" at the bottom. If you see orange error text, read the line number it mentions; it's almost always a missing semicolon or a typo.
  2. Click the arrow (Upload). This compiles again and sends it to the board. You'll see progress messages, then "Done uploading".

And… there it is. On for one second, off for one second. That's your first program running on real hardware. Take a moment, that's genuinely the hardest step of the whole course done!

Upload failed?

  • Re-select the board and port from the dropdown.
  • Double-tap the reset button quickly. The board enters bootloader mode (the RGB LED next to the USB port starts pulsing), then the port may change, so re-select it and upload again.
  • Close any other program that might be using the port (e.g. another IDE window or 3D printer software).

7. Play with it (≈3 min)

This is the maker loop: change, upload, observe, repeat.

Recap

Today you:

  1. Installed the Arduino IDE and the Arduino ESP32 board package.
  2. Selected your board and port.
  3. Learned that setup() runs once and loop() runs forever.
  4. Used pinMode, digitalWrite and delay to blink the built-in LED.
  5. Learned the difference between Verify and Upload, and how to fix the common upload problems.

Mini-challenge

  1. SOS: make the LED flash SOS in Morse code: three short (200 ms), three long (600 ms), three short, with a 200 ms gap between flashes, then a 2 second pause before repeating.
  2. Heartbeat: make a "ba-dum… ba-dum" pattern: two quick flashes, then a longer pause.
  3. Bonus: add comments to every line explaining what it does, in your own words.

Next class, we leave the built-in LED behind and wire our own LED on a breadboard, and learn why every LED needs a resistor. See you then!

Members can track their progress.

Community

Class discussion

No comments yet. Be the first to share how it went.

Join free to comment, share photos of your build and track your progress. No real name needed.

Join free Sign in

Post to the community board · See posts for this class · Community guidelines · Be kind, keep it about the build.