The Arduino IDE & Uploading Your First Sketch

Now that you’re familiar with your Arduino Uno board and its onboard hardware components, it’s time to get to know the softer side …I mean software side of Arduino, the Arduino Integrated Development Environment – or Arduino IDE for short! This free software is how you’ll write programs for all your awesome projects and upload it to the board. Let’s see how to download, install, and configure the Arduino IDE to work with your Arduino Uno board and other boards you use in the future. Then we’ll take a closer look at what a sketch looks like and the important code blocks you’ll be working with in every sketch you write. Finally, it’s time to get our Arduino Uno to do something – by uploading our first sketch!

Download and Install the Arduino IDE

I highly recommend that you only download the Arduino IDE software from the official website here:

The download page will look something like this:

Download the Arduino IDE from the Website

The Arduino IDE is constantly being updated and the latest version is featured towards the top of the page. Choose the download option that matches your computer’s operating system.

Other Drivers

If you have an Arduino-compatible (Arduino clone) board rather than the original, you may need to install additional drivers depending on its onboard USB-to-serial converter chip. Popular chips include FT232, FT231x, PL2303 or CP2102/CP2103/CP2104 and may require a separate driver. Your board’s manufacturer will usually have download options for the drivers you need on their website.

Power Up the Arduino Board

After you’ve successfully installed the Arduino IDE and necessary drivers for certain clones, connect your Arduino or Arduino-compatible board to your computer using a USB cable. Make sure the green “ON” LED turns on. You may also notice other lights blink when you first plug in your Arduino board like the RX and TX LEDs.

The green "ON" LED indicates the Arduino board is getting power.

If none of the LEDs turn on:

  • Try another USB cable
  • Make sure nothing metallic is touching the board, especially underneath it that could be causing a short.
  • Try another USB port on your computer.
  • If you’re using a USB hub, try plugging directly into the computer.

If you’re still having trouble, your Arduino may be faulty.

Configure the IDE for your Arduino Board

There are so many microcontroller boards that you can program using the Arduino IDE but the software doesn’t have the ability to “auto-detect” which model board you have plugged in. Arduino programs, called sketches, need to be compiled differently depending on your board’s microcontroller chip. Setting the board type within the IDE is an important step so your sketches compile correctly.

To set your board type, go to Tools -> Board, and choose your Arduino model from the list. In our case we have an Arduino Uno (or Arduino Uno clone) so choose Arduino Uno:

Select the Arduino Uno from the Boards drop-down list.

Select the Correct Serial Port

With your Arduino board identified by the IDE you’re half way there! Now we need to tell the IDE which USB port your Arduino board is connected to so it knows where to send data when you’re ready to upload your sketch.

Double check that your board is connected to your computer and go to Tools -> Port, and select your port from the drop-down list:

Windows 10
Mac / Linux

Some operating systems make identifying the correct port easy to do while others are a little trickier:

  • Windows – It will usually be COM3 or higher with the name of your board printed right next to it.
  • Mac & Linux – You’ll usually see “cu” or “tty” after the “dev/” in the list of options.

If you’re still having trouble identifying your serial port, then look again at the list of port options you’re being given. Unplug your Arduino and you’ll notice one of the options disappear. When you plug your Arduino back in, the port should re-appear and you’ll know that’s the one.

Your Arduino IDE environment is now configured to your board and ready to upload any sketches you write. Once set, the board and serial port settings are saved so if you close out of the program and re-open it in the future, you won’t have to go through the board configuration and serial port selection process again – unless you change the type of board you’re using. In that case you’ll have to re-configure by selecting the new board and correct port. It’s good to get in the habit of double checking your board and port settings every time you plug in a board!

Built-in Example Sketches

If you’ve never coded anything before, that blank sketch staring back at you can seem a bit intimidating. Where do you even get started learning to code?

Most beginners get their start by using and modifying existing code on the internet. That’s how I got started and it took me through my first projects. We’ll get into coding from scratch later on but for now, let’s take a look at some pre-existing code examples. Thankfully, the Arduino IDE has lots of great example sketches you can access right from the software. These are pre-written programs with explanations that can be used to blink LEDs, control servos, work with LCD displays and more!

Let’s open up one of these examples. Go to File -> Examples -> 01.Basics -> Blink

Access the Arduino Blink Examples along with many others in the Examples menu.

This should open up a new program window that looks like this, with a bunch of text and code in the editor area. Don’t worry if you’re not familiar with the code for now, let’s get familiar with the different sections of a sketch first.

Parts of an Arduino Sketch

The text and code that appears in the editor area is divided into sections and some lines appear in different colors. Some sections are mandatory, while others are optional. Let’s start at the top and work our way down this Blink sketch.


At the very top you’ll see a block of grayed-out text. It starts with /* and ends with */. This is called a multi-line comment and anything you type in here is ignored by the program. It’s a great place to describe your project, provide instructions on how to use the code, hook up devices or include sources and credits.

Example of a multi-line comment in an Arduino sketch.

Another type of comment is the single-line comment and it starts with a //. Anything that comes after the // is ignored by the program. These are great for short comments and can appear above lines of code or right next to them for additional tips and explanations. Unlike the multi-line comment, they appear a little darker gray and the comment must stay on one line. If you wrap your comment to the next line, it will cause errors because the Arduino IDE will try to read it as code.

Example of a single-line comment in an Arduino sketch.

In most cases you’ll see multi-line comments at the very top of the sketch to introduce and explain the project. Then single line comments are used within the code blocks for additional tips and clarifications. But you can use either commenting style anywhere in the sketch depending on how much you have to say about something.

Including comments in your sketches is optional. But when you start writing sketches from scratch, I encourage you to get into the habit of writing comments. How or why you write code in a certain way may make sense now, but if you ever have to return to the project in the future, you’ll be glad you took the time to write those notes!

setup function

Unlike comments that are optional but highly encouraged, the setup function is mandatory. Any code you put in this section gets executed one time when the program first starts. The code statements you normally see in this section are things like setting Arduino pins to either inputs or outputs, setting a servo to a starting position or LED strip to an initial color, displaying a welcome message on an LCD display, initializing sensors, the serial monitor and anything else that needs to happen one time at the start of the program or whenever the Arduino is reset.

This is what the setup function of an Arduino sketch looks like.

The first thing you’ll notice is that the word setup is written in the color green. Functions are used to group code statements together. Certain functions like the setup function are automatically recognized by the Arduino IDE as a special type of function. In this case, the Arduino IDE knows to run anything you put in here only once.

The word setup is followed by an opening and closing parenthesis (). When writing your own functions, this is where you would normally put arguments. Since the setup function doesn’t need any, they are left empty.

Then you’ll see an opening curly bracket { and a closing one } at the end of the section. Any code statements put in between these curly brackets are executed one time. In the blink example you’ll see a one-line comment and then a code statement. Don’t worry about what that line of code means at this point because we’ll break it down in the next Arduino lesson.

Put simply, the setup function is always structured like this:

void setup() {

The last thing you’ll note is that the setup function begins with the turquoise-colored word, void. Void simply means that this function will not return any data. Even though the word void means nothing it doesn’t mean that the function doesn’t do anything. It’s job is to execute all the code inside precisely one time.

Loop Function

The loop function is the main part of the sketch and therefore is also mandatory. It looks a lot like the setup function but instead of executing code just one time, the Arduino executes each line in order until it reaches the bottom (closing curly bracket). Then it goes back to the top of the loop function and starts over. This looping behavior continues indefinitely until the Arduino is either turned off or we give it a command to exit the loop.

This is what the loop function of an Arduino sketch looks like.

In this example you can see that there are four lines of code within the curly brackets of the loop function. Even if you don’t fully understand the code statements, the single-line comments next to them gives you a hint as to what each line does.

Even though the code inside the loop can get quite complex, it’s just a list of commands that need to be executed in order:

void loop() {
 CODE INSTRUCTION 3; //etc. then start again at the top

Both the loop and the setup function are required in your sketch. The program will not compile without them.

Compiling and Uploading Code

Now that we’re familiar with the main structural elements of a sketch, let’s upload this Blink Example to our Arduino Uno board. Based on the comment block at the top, we expect this sketch to blink our onboard LED by turning it on and off for one second each.

Arduino IDE toolbar with quick action buttons.

The toolbar at the top of your Arduino sketch file features a few handy short-cut buttons. These same options are available in the main menus too but it’s convenient having them in one place.

The first two buttons are the ones you’ll use the most.


This first button on the left verifies and compiles your code so it’s ready to be uploaded to the Arduino board. During the verification process your code is checked over for mistakes, similar to a spell or grammar check. If there are any errors, the program does it’s best to highlight the line(s) of code where the error is happening along with an explanation of the error in the black notification area.

The verify/compile button of the Arduino IDE toolbar.

If the verification process doesn’t find any errors then the IDE will compile it. This means that it will take the human-readable code you write in C/C++ and translate it into machine code that the microcontroller can understand. Your code is also organized and optimized for the microcontroller chip on your Arduino board. That’s why it’s important to select the right board from the start within the IDE.

I highly recommend you verify/compile your code often as you write your sketch. That way, you find mistakes and fix any errors early on before they snowball into something more complicated to solve at the end.

Since we haven’t done anything with this sketch, click the verify button and watch it complete the process. You should get a message in the status bar when it’s complete and information about your sketch in the black notification area.

The status bar in the Arduino IDE let's you know when the verification/compiling process is done.

Our Blink Example sketch is now ready to be uploaded to the Arduino Uno board.


The button just to the right of the Verify button is the Upload button. Double check that your Arduino board is connected to the computer and click the Upload button.

The upload button in the Arduino IDE toolbar.

Just like the verify/compile process, you’ll see the status of your upload in the status bar and then information about your sketch in the black notification area. The orange/amber TX and RX LEDs on the board will also flash quickly during the upload process.

The status bar in the Arduino IDE let's you know when the code is finished uploading to your Arduino board.

Now look at your Arduino Uno board. The onboard LED should be blinking at a rate of one second on and one second off. The sketch is saved in the Arduino’s flash memory so it doesn’t get erased if you unplug the board. The next time the Arduino is powered on, the same sketch will start running again which will blink the onboard LED.

The onboard LED on the Arduino Uno blinking.

You uploaded your first sketch! Next we’re going to take a closer look at the code blocks that make up the Blink Example to understand how statements and functions are put together and then modify them to suit our needs. This will allow you to begin exploring other code examples and know where to make changes to get the results you want.

Learn Arduino for Beginners


Go from absolute beginner to building and coding your own projects from scratch using the most popular Arduino components, even if you’ve never coded or built a circuit before.

Make real progress on your creative electronics goals by building and coding 30+ Arduino projects in real-time with me. Access our entire library of past course broadcasts plus a new LIVE course every month!

Some links in this post are to affiliate sites. If you purchase something through them, I may earn a small commission — which costs you nothing! I am very grateful when you use my links to make a purchase.

Stop Scrolling. Start Creating.

Find out about new courses and live events!
Get my latest guides and reference materials.
Unsubscribe anytime!