Getting started

Your first Arduino blink

Level Beginner
By admin 1 min read 5 readers

In this series

Getting started path

Lesson 2 of 3

Log in to track your progress.

0 of 3 lessons completed · 0% complete

Your first Arduino blink

Turn an LED on and off — the classic embedded “Hello, world!”.

Goal

Blink an LED connected to digital pin 13 (or any free pin with a resistor) every second.

Wiring

TEXT
Arduino pin 13 ──[220 Ω]── LED (+) ── LED (-) ── GND

Sketch

CPP
const int ledPin = 13;

void setup() {
  pinMode(ledPin, OUTPUT);
}

void loop() {
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(1000);
}

Upload the sketch

  1. Connect the board via USB
  2. Select the correct board in Tools → Board
  3. Select the port in Tools → Port
  4. Click Upload

If upload fails, check the cable and drivers as described in the setup tutorial.

Some boards have a built-in LED on pin 13. In that case you can skip external components and use the same code.

What you learn

  • pinMode() configures input/output
  • digitalWrite() sets HIGH/LOW
  • delay() blocks execution (advanced tutorials use non-blocking timers)

Materials

  • Arduino Uno (or compatible) × 1
  • 5 mm LED × 1
  • 220 Ω resistor × 1
  • Breadboard and jumper wires × 1 set

Tools

Next in series

Comments

Comments (0)

Demo resets in 00:29:37