Lab 05
Beginner
Arduino

Your first Arduino LED blink

Identify the three parts of the basic GPIO exercise: pin setup, output state and timing.

MCU:Arduino Uno · GPIO
Official reference documentation
01

What you'll learn

  • Understand the roles of setup() and loop().
  • Configure LED_BUILTIN as a digital output.
  • Alternate HIGH and LOW states with digitalWrite.
  • Control visible timing with millisecond delays.
02

Components needed

  • Arduino UnoOr a compatible documented board
  • Built-in LEDNo external LED circuit required
  • USB cablePower and sketch upload
  • Arduino IDECorrect board and port selected
03

Circuit diagram

04

Code

Study the highlighted firmware, then copy it into the matching development environment. Adapt board pins and initialization before compiling.

main.c
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}

LED_BUILTIN selects the documented onboard LED pin. pinMode establishes it as an output, digitalWrite chooses its logic level, and delay blocks the sketch for the requested milliseconds. On the Uno, HIGH and LOW alternate the onboard LED state.

05

Simulate It

Run the circuit in your browser when a Wokwi simulation is connected to this lesson.

Wokwi simulation placeholder

Add the public Wokwi embed URL for this lab to launch the interactive simulator here.

wokwiEmbedUrl: "https://wokwi.com/projects/..."
06

Expected Output

The built-in LED repeatedly turns on for 500 ms and off for 500 ms, producing one complete blink cycle every second.

07 · Challenge Task

Take this lab further

Create a heartbeat pattern: two quick 100 ms flashes separated by 100 ms, followed by a 700 ms pause.

Up next · Lab 06

Read a button safely

Next Lab
Back to all labs