Introduction to Arduino IDE

Lesson 3

Where it begins: How to use the Arduino IDE

In this lesson, we are going to create a simple project that will introduce you to Arduino programming and hardware connections.   If you are an absolute beginner, please look at our previous guide to Arduino for beginners. We will go over the essential aspects of the last lesson to keep things fresh and comfortable.

Items Needed

Arduino Board (Uno or Mega)


Jumper wires

USB cable for Arduino

LED (Any color)

Push Button

10K resistor

Software Download

Before we begin programming, we have to download the integrated development environment needed to interpret and facilitate uploading the code to the desired Arduino board. You can download the Arduino IDE for free at .

Download the latest software compatible with your computer operating system. After the download is complete, run the software and follow the installation instructions.

Arduino IDE Interface

After a successful installation of the software, you can open it up by clicking the application icon or searching it among the installed applications. You can now look at the IDE to get familiar with different sections and tabs.

Connecting the Arduino Board

At this point, you are ready to connect your Arduino board and start experimenting with your program. Plug the flat end of the USB cable into your computer USB port and the other end to the Arduino board USB port. The inbuilt LED in Arduino should light up to indicate that the Board is powered. For a new board, one of the LED will be blinking periodically.

Ones the Board is connected, you will need to select the Board and Port through the Arduino IDE. Go to Tools, then Board, choose the Board you are using (For Arduino Mega Arduino/ Genuino Mega or Mega 2560). You will then go to Tools then Port and select the Port where the Board is connected.

Project 1: Blinking an LED

Blinking and LED is the “hello world” of microcontrollers. Therefore, you are now ready to blink your first LED or do the first Arduino project. In this project, we will use the Arduino internal LED connected to pin 13. Then later, we will add an external LED to make it visible and exciting.

At this stage, you can copy the code below and paste it into the open Arduino sketch. Make sure to delete all the default code in the new sketch before pasting the code.

//Start Copying from here

/*For more information please visit our website

 * The code will help you light up an LED and turn it off periodically

 * Therefore, the led will be blinking


int BUILTIN_LED=13; //declare pin 13 as the built in LED

//void setup function only runs ones 

void setup () {//void setup function help us to setup the pin functions (output or input)

  // initialize digital pin 13 as an output.




// the loop function runs over and over again forever

void loop () {

  digitalWrite(BUILTIN_LED, HIGH);   // turn the LED on (HIGH is the voltage level)

  delay(1000);                       // wait for a second

  digitalWrite(BUILTIN_LED, LOW);    // turn the LED off by making the voltage LOW

  delay(1000);                      // wait for a second



Now you should click on the verify button, the checkmark on the top left side of the sketch. The IDE will look for any errors in the code. Ones the “Done Compiling” message is displayed on the bottom left, the code will be ready to upload to the Arduino board. Click on the upload (the forward arrow at the top) to send the code to the Arduino board. The built-in LED of the Arduino will then flash rapidly for a few seconds before the program executes. If everything was successful, the inbuilt LED will light up for 1 second and then off for one second and then continue in a loop.

Congratulation! You have successfully run the first code.

Let Us, Tinker, with the Code

In the previous sketch, the periodic light of the LED is guided by the time indicated in the delay () function. Now you can try to change the value within the brackets to see how the pattern changes. Remember, the delay () function uses millisecond as the default time measurement unit. 1 second = 1000 millisecond. After every change is made, make sure to upload the code to the Board again to see the effect of the new code. Changing a section of the code is a good way to study the elements of the code and its effects on the hardware.

The original code (1000) turns on the LED for 1 second and then off for 1 second.  By adjusting the code from (1000) to (200), it shortens the time between on and off, which makes it blink faster.

Hooking Up The LED

After confirming that the internal LED is functioning as intended, you can now hook up an external LED to make the pattern visible. At this point, we will need a breadboard, jumper wires, LED, and the programmed Arduino board. If you look at the LED, you will realize that one leg is longer than the other. The longer leg is the positive terminal, while the shorter leg is the negative terminal.

The positive terminal should be connected to pin 13. In contrast, the negative terminal should be connected to the GND pin of the Arduino board. To connect the LED, insert it into two holes in the breadboard and use jumper wires to connect the LED to the Arduino board, as shown below.


After connecting the external LED, you should note that the LED is also blinking as the internal LED.

Now you can try to explore further by changing the value within the delay and rearranging the code block within the void loop. The possibilities are endless.

Adding More LEDs

Sometimes, just using one LED may not be as exciting as using multiple LEDs to visualize different elements of the program. If we can light up one LED, we sure can light up a million more. However, the Arduino pins can only individually control one single LED per pin. However, you can still hook up many LEDs into one single pin and control them simultaneously.

At this point, we want to experience the joy of lighting up the LEDs in a pattern. Therefore, we will only connect one LED per Arduino pin (you are free to explore other options). Now to connect LEDs to different pins, we will have to use resistors to protect the LED from the excess current that may damage the internal parts. In a similar manner as the previous LED, you will connect another LED pin 12,11 and 10. You can follow the bellow schematics to connect more LEDs.

Code for Additional LEDs




void setup() {

// put your setup code here, to run once:

pinMode(13,OUTPUT);//setting pin 13 to output to cointroll the LED

pinMode(12,OUTPUT);//setting pin 12 to output to cointroll the LED

pinMode(11,OUTPUT);//setting pin 11 to output to cointroll the LED

pinMode(10,OUTPUT);//setting pin 10 to output to cointroll the LED



void loop() {

// Turning ON the LEDS

digitalWrite(13,HIGH);//Turn on the LED on pin 13

delay(100);//Wait for 100 milliseconds

digitalWrite(12,HIGH);//Turn on the LED on pin 12

delay(100);//Wait for 100 milliseconds

digitalWrite(11,HIGH);//Turn on the LED on pin 11

delay(100);//Wait for 100 milliseconds

digitalWrite(10,HIGH);//Turn on the LED on pin 10

delay(100);//Wait for 100 milliseconds


//Turning off the LEDs

digitalWrite(13,LOW);//Turn off the LED on pin 13

delay(100);//Wait for 100 milliseconds

digitalWrite(12,LOW);//Turn off the LED on pin 12

delay(100);//Wait for 100 milliseconds

digitalWrite(11,LOW);//Turn off the LED on pin 11

delay(100);//Wait for 100 milliseconds

digitalWrite(10,LOW);//Turn off the LED on pin 10

delay(100);//Wait for 100 milliseconds





Now you can copy the code above and past in an empty Arduino sketch. Verify and upload the code to your Arduino board. After successfully uploading the code and correctly connecting all your LEDs, the LEDs should light up in a pattern and off in a pattern. You can now try to make changes to the code to see how the behavior of the LEDs changes.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *