Arduino Leonardo – Blinking a LED

arduino-logoArduino was built in Italy on open source hardware, a great inspiration for many products. Many companies and electronics products today are built on open source. To make a project open source, a person releases all of the design files to the public, so that the community can examine them, suggest changes and improvements, contribute and help make projects better!

arduino-leonardoThe Arduino Leonardo is the main model of the Arduino, with just enough features for you to get started. It is also one of the most inexpensive and easy to use micro-controller platforms.

Below is the Arduino Leonardo and all of its main components that you should know, and what they do.


Next up, we’re going to install the Arduino software on your computer.
Go to Arduino Software web page to download the Arduino IDE (computer software) for PC, Mac, or Linux. Follow the instructions on if you are on a Windows machine, to install the last pieces of the software.

Arduino is written in a mixture of C and C++, an easy to use programming language. You might think that coding is all ones and zeros, but not with Arduino. The main idea that was thought up by the Arduino team was that the Arduino has to be accessible, or easy to use for anyone (kids, designers, artists, tinkerers, and makers). Thus, the Arduino code language is mostly in plain English, with some numbers here and there that are easy to understand.

This is the Blink sketch (sketch is another word for the program that runs on your Arduino).
Open the Blink sketch by going to File > Examples > 01.Basics > Blink. The blink sketch turns an LED on for a second, and off for a second, making it blink. You can use the built in LED at pin 13, labeled ‘L’, or plug in your own LED.

This example code is in the public domain, which means anyone has access to it.



Turns on an LED on for one second, then off for one second, repeatedly.

Explaining what the code will do.
Anything within /* *\/ or after // is ignored, and is a comment to yourself
on what the piece of code will do (a great reminder after creating tens or hundreds of sketches).


// The format:
// int (an integer/number)
// led (name) = 13 (pin where LED is connected to) 
// ; (semicolons are needed after every line that you type out code, 
// except for setup(), loop(), and any other function (anything with () ).

int led = 13;

// Void setup: code that runs once; setup your inputs and outputs.
void setup() {

// Setup our output
pinMode(led, OUTPUT);

// Void loop: runs over and over after setup
void loop() {

// Turn the LED on (HIGH is “on” in the Arduino language)
digitalWrite(led, HIGH);

// Delay/wait for a second (1000 milliseconds = 1 second)

// Turn the LED off (LOW is “off” in the Arduino language)
digitalWrite(led, LOW);

// Delay/wait for a second

It is now time to upload the sketch to our Arduino board!
Click on Tools > Board > Arduino Leonardo (if you are using an Arduino Leonardo), and click on Tools > Board > Port, and select the one using /dev/tty.usbmodemfd121 (somewhat along those lines) if you are using a Mac, and select the lowest COM Port if you are on a PC. Then, press the Compile + Upload button pictured below (the right arrow).
This will verify that there are no errors in the code, and then upload it to the Arduino board.
If there were errors, these would show as a message in the black rectangle below the code.


After about 5 seconds, the LEDs should blink very fast on the board, and then after that LED ‘L’ should be blinking one second on, and one second off.



scroll to top