Blink - My First Arduino Project

In this project, you'll learn about the Arduino IDE programming environment and how to make a LED light blink.

Parts needed: Arduino USB cable
1 Double-click on the Arduino icon to start the Arduino IDE program. Arduino icon
2 Create a new program by selecting File from the menu
  • then select Examples
  • then select Basics
  • then select Blink
Blink template
3 You will see this Blink template.

Words between /* and */ are comments, and are ignored by the computer.

Words after the two slashes // are comments, and are ignored by the computer.

There is a light (LED) on the Arduino board that is connected to pin 13 on the board.

The int command assigns the name "led" to pin 13.

Code that you put inside the void setup() routine is executed only once on startup or on reset.

The pinMode command tells the Arduino that you will be controlling the led pin (i.e. pin 13) for OUTPUT.

Code that you put inside the void loop() routine is executed repeatedly forever (or until you turn off the power)

The digitalWrite command sends a HIGH or LOW signal to the led pin. HIGH means to turn on the LED, and LOW means to turn off the LED.

The delay command makes the Arduino wait a bit. The number specified in the delay command is the number of milliseconds to wait.

1000 ms = 1 sec
Blink template
4 Connect your Arduino board to your computer using the USB cable. USB cable
5 From the Arduino IDE program menu, select Tools
  • then select Serial Port
  • then select the COM port that your Arduino is connected to. This usually is the COM port with the largest number.
If you don't see one, then you need to follow these instructions to install the driver.
selecting COM port
6 Press the upload button to upload the program onto the Arduino board. Upload icon

If it is successful you should see the words Done uploading at the bottom, and the Arduino will automatically run the program.

You should see the green LED on the Arduino board blink on for 1 second and then off for another second.

Done uploading

If you have selected the wrong COM port or if there are errors in your program, you will see an orange error message at the bottom. You'll have to correct the error(s) and then upload your program again.

COM port error
Congratulations! You've completed your first Arduino project to make a LED blink!

Now click on the Experiments button below to test yourself. After you have finished the experiments, come back here and click on the Next Project button to learn how to make music in the next project.

You have completed your first Arduino project!