Arduino IDE 2 and the first program

On the previous page, we became familiar with the basics of Arduino. Now it is time to create and upload our first program.

Arduino for beginners · Lesson 1

Difficulty: Beginner

Created: February 2021

Technically reviewed: August 2026

Reference platform: Arduino Uno family / general Arduino API

Prerequisites: None

First, we will install the Arduino IDE 2 development environment, become familiar with its most important controls, connect the Arduino board, and then upload the classic Blink example program.

By the end of the lesson, a working program will be running on the microcontroller.

What is the Arduino IDE?

The Arduino IDE (Integrated Development Environment) is the program in which we can create, edit, compile and upload our Arduino programs.

Arduino programs are traditionally called sketches.

The IDE performs many background operations for us. At first, we only need to concentrate on writing the program, selecting the correct development board, and then compiling and uploading the sketch to it.

In this series, we will use Arduino IDE 2.

Arduino IDE 2 main window with the code editor, toolbar, board and port selector, and output panel.
The Arduino IDE 2 main window and its most important controls.

Downloading Arduino IDE 2

The Arduino IDE can be downloaded from the official Arduino website.

Download Arduino IDE

Select the version for your operating system, and then download it.

Arduino IDE 2 is available for the most commonly used desktop operating systems, including Windows, macOS and Linux.

The official Arduino download page showing the current Arduino IDE 2 version and the download options for different operating systems.
Arduino IDE 2 download options on the official Arduino website.

Installation

The exact installation process depends on the operating system.

On Windows and macOS, the IDE can generally be installed by launching the downloaded installer or package. On Linux, the process may vary depending on the selected package format.

After installation, start the Arduino IDE.

During its first launch, the IDE may download or install additional components. Allow these operations to finish before continuing.

Note

Some Arduino-compatible development boards may require an additional driver or a separate board package. We will deal with this if the particular board actually requires it.

Connecting the Arduino board

Connect the development board to the computer using a suitable USB data cable.

The word “data” is important here: some USB cables are only suitable for charging. With such a cable, the board may receive power while the computer is still unable to communicate with it.

After a successful connection, the Arduino IDE automatically recognises many supported boards.

 Arduino Uno board connected to a computer with a USB data cable
Connecting the Arduino board to the computer with a USB data cable.

Board and port — what is the difference?

These are two terms that we will encounter frequently.

Board

The board tells the Arduino IDE which development board we are creating the program for.

This is necessary because different Arduino boards may use different microcontrollers, memory and peripherals.

Port

The port identifies the operating system communication connection through which the physically connected board can be reached.

Put simply:

Board → what hardware are we creating the program for?

Port → which connected device should we communicate with?

For supported devices, the IDE 2 Board Selector allows us to select both conveniently.

The Arduino IDE 2 Board Selector showing the connected Arduino board name and its port.
Selecting the correct development board and communication port with the Board Selector.

What is a board package?

For the Arduino IDE to create a program for a particular development board, it must know its hardware and the associated compilation environment.

These components are contained in what are known as board packages.

We can install and manage these packages in the IDE’s Boards Manager.

If the IDE recognises the connected board but the required package has not yet been installed, it may offer to install it.

 Arduino IDE 2 Boards Manager showing an installed or installable Arduino board package.
Managing the packages required to support development boards in the Boards Manager.

Opening the Blink example program

The Arduino IDE includes many built-in example programs.

We will begin with the classic Blink example.

Open the Blink sketch from the IDE’s built-in examples.

The program looks similar to this:

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

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);

  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}

The program switches the development board’s built-in LED on and off.

We do not need to understand every instruction yet. We will examine them in detail in the following lessons.

For now, our goal is to compile and run our first program.

Arduino IDE 2 with the Blink example program open and the Verify and Upload controls visible.
The Blink example program open in Arduino IDE 2.

Verify — checking and compiling the program

The Verify button at the top of the IDE allows us to check and compile the sketch without uploading it to the development board.

Start the Verify operation.

If the program compiles without errors, the IDE reports this in the output area at the bottom.

We have not changed anything on the Arduino board yet. We have only confirmed that the IDE can create a program from our source code for the selected board.

Arduino IDE 2 after successfully compiling Blink, with the code and lower output panel visible.
Successfully checking and compiling the Blink program with Verify.

Upload — uploading the program

Now comes the really interesting part.

Check that the correct board and port are selected, and then click the Upload button.

The Arduino IDE compiles the sketch and then uploads the resulting program to the development board.

If everything worked correctly, the upload finishes successfully, and the board’s built-in LED soon starts blinking.

Our first Arduino program is complete. 🎉

Arduino IDE 2 after successfully uploading Blink, with the upload result visible in the output panel.
Successfully uploading the Blink program to the Arduino board.
 Arduino Uno board running the Blink program with its built-in LED illuminated.
The uploaded Blink program in operation: the board’s built-in LED blinks continuously.

What actually happened?

When we pressed the Upload button, much more happened than the IDE simply “copying” the text visible on the screen to the Arduino.

In very simplified terms:

  1. We wrote or opened the sketch source code.
  2. The Arduino build system prepared it for compilation.
  3. The compilation tools for the selected board converted it into a machine program.
  4. The resulting program was uploaded to the microcontroller.
  5. The microcontroller began executing it.

This is why the operation of a physical device changes according to the program we write on the computer.

This is one of the best things about Arduino. 🙂

What does Blink do?

Now let us take a closer look at the program.

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

setup() runs when the program starts. Here, we configure the pin associated with the built-in LED as an output.

Next comes:

void loop() {

The contents of loop() are executed again and again.

digitalWrite(LED_BUILTIN, HIGH);
delay(1000);

We switch on the LED and then wait for approximately 1000 milliseconds, or one second.

Next:

digitalWrite(LED_BUILTIN, LOW);
delay(1000);

we switch it off and wait for another second.

When we reach the end of loop(), execution continues again from its beginning.

This is why the LED keeps blinking continuously.

We will explore how setup(), loop(), pinMode() and digitalWrite() work in more detail in the following lessons.

🧪 Try it!

Now let us change something in the program.

Find these two lines:

delay(1000);

and change both of them to:

delay(250);

Run Verify again, and then upload the modified program.

What happened to the LED?

We now wait for one quarter of the previous time between state changes, so the LED blinks much faster.

Try some other values as well.

For example:

delay(50);

or:

delay(2000);

This is our first modification to an Arduino program.

Along the way, we have already learned one of the basic development cycles:

modify → compile → upload → test

We will use this cycle many more times.

If the upload fails

If it does not work on the first attempt, there is no need to panic. It is worth checking a few simple things.

  • Board: is the correct development board selected?
  • Port: did we select the port belonging to the connected Arduino?
  • USB cable: is it definitely capable of data transfer and not only charging?
  • USB connection: try disconnecting and reconnecting the board.
  • Serial port: is another application currently using it?

If these are all correct but the upload still fails, it is worth examining the displayed error message.

Specific upload problems will be covered in a separate troubleshooting guide.

Summary

In this lesson, we:

  • installed the Arduino IDE 2 development environment;
  • connected the Arduino board;
  • learned the difference between the board and the port;
  • became familiar with the concept of a board package;
  • opened the Blink example program;
  • compiled it using Verify;
  • uploaded it to the microcontroller using Upload;
  • and then modified how the program works.

The most important result, however, is even simpler:

our own program has already run on a real microcontroller.