If you plugged in your board before installing the IDE and drivers, you may need to restart your computer.
The LED labeled 13 blinks when you power a new board.
Depending on your computer or operating system, it may take a little bit for the computer to identify the new hardware you just plugged in and associate it with the drivers you installed. After your computer recognizes the new device, click
and mouse over the
option, as in
The Board selection list in the Tools menu
A list of pre-supported Arduino boards should appear. If you’re using a standard Arduino Uno or the SparkFun RedBoard, select the option
. If you end up using a board other than an Uno or RedBoard in the future, select the correct Arduino based on your board’s documentation—this book assumes that you’re using the Uno or an Uno derivative.
Each device that’s plugged into your computer has a unique communication port identifier. You need to configure the IDE so that it knows which port your Arduino is connected to. To do this, first select
to see the communication port options for your device. You’ll see different options depending on your operating system.
Selecting the communication port on Windows
On Mac or Linux machines, the communication port should be listed as
, but only the one with this unique ID string will map to your Arduino. If no options show up, see “
Basic Arduino Troubleshooting
” on page
Selecting the communication port on OS X
“Hello, world!” is the classic first program that many beginning programmers write. In most other programming languages, this program displays
to the screen. Because the Arduino doesn’t have a screen, its version of “Hello, world!” is a blinking LED.
For your first sketch, we’ll show you how to use an example that comes with the Arduino IDE. With your board connected to your computer, click the
drop-down menu and select
as shown in
to open a sketch called
A new IDE window containing the Blink sketch should open. In this window, click
or click the
icon. The IDE will turn this relatively human-readable code into 1s and 0s that the Arduino understands (a process called
) and then upload the sketch to your board.
Finding the Blink sketch
After you click Upload, watch the alert area for status messages. It should say
and show a progress bar. After the compiling is complete, your computer will start to upload the sketch to your Arduino. The RX (receive) and TX (transmit) LEDs on your Arduino board should blink rapidly, indicating that the sketch is being transmitted to the Arduino board. The TX light blinks because you’re transmitting something to the Arduino, and the RX light blinks because as the Arduino receives the sketch, it responds to your computer to confirm receipt. When the upload process is done, the status area on the IDE should say
, and the LED labeled 13 on your board should blink, as in
Turning on LED 13
If you get any error messages, your Arduino might not be talking to your computer. Read the next section,
Basic Arduino Troubleshooting
,” for some common problems to look out for, and then try uploading the sketch again.
The Arduino, like any other programmable piece of electronics, is temperamental at times. Here are a few troubleshooting tips for when you have trouble programming your Arduino.
1. Make sure that your Arduino is plugged into your USB cable and that the cable is plugged into your computer all the way. It’s easy to have the cable only partially plugged into the board. You can also try unplugging it and plugging it back in.
2. Always confirm the board selected in the Board menu is the board plugged into your computer. For our examples, we will have
3. Confirm that the correct communication port is selected in the Tools
Port menu; it should have a checkmark or dot next to it. If you’re not sure which port goes with your Arduino, unplug your USB cable from your computer, refresh the communication port listing, and watch to see which port disappears.
4. Make sure you didn’t accidentally type some stray characters into your example sketch. The code will not compile if there are any extra characters.
5. On Windows, check your computer’s Device Manager. Make sure that there isn’t an exclamation mark next to the device. If there is, you need to reinstall the drivers manually.
6. If you’re still getting error messages, reinstall the drivers for your board. We have additional instructions available at
These six tips are solutions to common speed bumps for anyone new to Arduino, so start here. If none of these suggestions solves the issue, just stay calm, be patient, and remember that you’re not the first one to have a problem. If you get completely stuck, look for solutions on the official Arduino forum at
The Blink example sketch
Turns an LED on for one second, then off for one second,
Most Arduinos have an onboard LED you can control. On the
UNO, MEGA, and ZERO, it is attached to digital pin 13;
on the MKR1000 it's on pin 6. LED_BUILTIN is set to the
correct LED pin independent of which board is used.
If you want to know which pin the onboard LED is connected
to on your Arduino model, check the Technical Specs of
your board at https://www.arduino.cc/en/Main/Products
This example code is in the public domain.
modified 8 May 2014
by Scott Fitzgerald
modified 2 Sep 2016
by Arturo Guadalupi
modified 8 Sep 2016
by Colby Newman
//the setup function runs once when you press reset or
//power the board
//initialize digital pin LED_BUILTIN as an output
//the loop function runs over and over again forever
//turn the LED on
//(voltage level is HIGH)
//wait for a second
//turn the LED off
//(voltage level is LOW)
//wait for a second