Illustration: in the evening, the built-in LED glows on a board connected to a laptop, beside a cup of tea.Lights and displays
Illustration (made with AI): roughly what the finished project looks like.

Your First Program: Blink an LED

Everyone starts here: the LED built into the board turns on and off once a second. You'll learn how to install the Arduino IDE, write code and upload it to the board.

Difficulty
Beginner
Time
15 min
Age
8+
Parts
1, 1 on the site

Adapted from “Blink” by Arduino. Licence: CC BY-SA 4.0. This translation is shared under the same licence. The parts list and the tips are RoboHub's.

Variations

Choose a variation and the parts list updates.

Instructions

  1. Install the Arduino IDE

    Download Arduino IDE 2 from arduino.cc and install it. Connect the board to the computer with a USB cable.

  2. Choose the board and port

    In the list at the top, choose your board, for example Arduino Uno R4 WiFi, and the port it is connected to. For the R4 the IDE offers to install the board package: accept it.

  3. Upload the code

    Paste the code and press the arrow (Upload). A few seconds later the LED next to the “L” label on the board starts blinking.

    Arduino C++
    // The LED on the board: one second on, one second off.
    void setup() {
      pinMode(LED_BUILTIN, OUTPUT);
    }
    
    void loop() {
      digitalWrite(LED_BUILTIN, HIGH);   // on
      delay(1000);                       // wait a second
      digitalWrite(LED_BUILTIN, LOW);    // off
      delay(1000);
    }
  4. Change the speed

    delay(1000) means 1000 milliseconds, one second. Write 200 and the LED blinks five times faster.

    Illustration: the built-in LED glowing on a board connected to a laptop.

    Illustration, made with AI

  • Lights and displays
    Beginner30 min8+

    A Traffic Light with Three LEDs

    Build a small model of a real traffic light: green, flashing green, yellow, red and finally red with yellow, just like on the street.

    4/4 parts on the site
  • Lights and displays
    Beginner45 min10+

    Pedestrian Crossing with a Button

    Cars have green until a pedestrian presses the button. Then the cars get red, the pedestrians get green and a buzzer ticks, just like at a real crossing.

    6/6 parts on the site
  • Lights and displays
    Beginner30 min8+

    A Colour-Changing Lamp with an RGB LED

    An RGB LED holds three small LEDs: red, green and blue. Mix their brightness and you get any colour, while the lamp slowly changes from one colour to the next.

    5/5 parts on the site