Getting started with Arduino


Have you bought an Arduino but have no idea how to get started with Arduino. So don’t be panic, this tutorial series is for you. But do you know everything about Arduino before getting started with Arduino? No, then first read this article: Arduino Board.

What is Arduino?

Arduino is a microcontroller that is programmable and an open-source device. You may have seen some gadgets or remote control devices such as electronic toys, TV remotes, electronic signals or vending machines, etc. many times.

In this tutorial, we are using the Arduino Uno Board because the Arduino Uno is easy to use for a beginner and has efficient pins to use.

To know more about Arduino Uno Pinout, Schematics, Technical Specification read us this article: Arduino Uno.

Step 1: Download and Install the IDE Software

To program the Arduino we will require software called Arduino IDE (Integrated Development Software). This software is open-source and free to download. You can download this software from Arduino Official Site.

Required OS:

  • Window XP 32 or 64 bit or more
  • Linux 32 or 64 bit
  • Mac os x or higher

If you have a reliable Internet connection, you should use the online IDE (Arduino Web Editor).

download ide

Step 2: Know about Arduino IDE

arduino ide
  1. Menu Bar:  Gives you access to the tools needed for creating and saving Arduino sketches.
  2. Verify: Compiles your code and checks for errors in spelling or syntax.
  3. Upload: This button uploads the program to the connected Arduino. Lights on the board will blink rapidly when uploading.
  4. New: Opens up a new window containing a blank sketch.
  5. Save: This saves the sketch you currently have open.
  6. Open: Allows you to open a saved sketch or one from the stored examples.
  7. Sketch Name: When the sketch is saved, the sketch name is displayed here.
  8. Serial Monitor:  When the board is connected, it will display the serial information of your Arduino.
  9. Code Area: This area is where you compose the code of the sketch that tells the board what to do.
  10. Message Area:  This area tells you the status of saving, code compiling, errors and more.
  11. Text Console: The text console shows the details of the error message, size of the program that was compiled and additional info.
  12. Board and Serial Port:  It displays the connected board name and port number.

Step 3: Configure Arduino IDE

Now connect your Arduino to your computer with the help of USB cable. Plug one end of the USB cable to the Arduino Uno and then the other end of the USB to your computer’s USB port.

Once the board is connected, you will need to go to Tools » Board » Arduino Uno.

arduino ide 2

Select COM port on which Arduino is connected. To select the port, go to Tools » Port » select port name.

Getting started with Arduino

Step 4: Uploading Code

We load a simple code that turns on and off the built-in led of Arduino. Now open the LED blink example code from Files » Examples » 01 Basics » Blink and click on the Upload button. After a few seconds of code compiled, the RX and TX led on the board will be flashing.

After a few seconds, the code upload finishes. Now you can see the pin 13 LED will be blinking.

If you can’t find the code then upload the following code.

Step 5: Connecting an External LED

Now we connect an external LED with the Arduino. For this, we will need the following components

  • LED.
  • Resistor 1 Kohms (kΩ).
  • Breadboard.
  • Jumper Wires.

Step 6: Circuit Diagram for getting started with Arduino

Connect the long leg of the LED with a resistor and another leg to GND of Arduino. Now connect another wire of resistor to the D13 pin of Arduino.

Getting started with Arduino

Structure of the Arduino Program

The Arduino program consists of three parts: structure, value, and function. Commonly, Arduino programs also called sketches.

int ledpin = 13;  // digital pin 13

void setup()    //setup() method runs once, when the sketch starts
  pinMode(ledpin, OUTPUT);  //initialize the digital pin as an output

void loop()   //loop() method runs over and over again   
  digitalWrite(ledpin, HIGH);   //turn LED on
  delay (1000);       //wait a second
  digitalWrite(ledpin, LOW);    // turn LED off
  delay(1000);          //wait a second

The code starts from the top and carries out the instruction sequentially. First, the setup() function will execute and then goes through the code in loop() function. When execution of loop() function ends, it goes back to the beginning of the loop.

This example continuously flashes an LED HIGH and LOW outputs to a pin.

The const keyword stands for constant. It is a variable qualifier that modifies the behavior of the variable, making a variable “read-only”. That means the variable value is not changeable but it can be used like any other variable of the same type.

The pinMode() function is used to configure a specific pin to behave as an input or an output.

To give a HIGH or LOW value to a digital pin we use digitalWrite() function.

When we do delay(1000) our Arduino stops on that line for 1 second. The delay() function is a blocking function. Blocking functions prevent a program from doing anything else until that particular task has been completed.

Here some more tutorials for you: