Arduino Programing Language | How To Program Arduino

Share This

Hello friends! Welcome back to ElectroDuino. This is Arduino Tutorial #3 – How To Program Arduino | Arduino LED Blinking. After understanding How to Download & Install Arduino IDE in Arduino Tutorial #2. In this blog post, we will discuss Introduction to the Arduino Programing Language, How To Program an  Arduino in Arduino IDE Software, and as an example, we explain the Arduino LED Blinking code.

Arduino Programing Language

The Arduino software is open-source. The C/C++ Programing Language used in Arduino IDE to write the Arduino program. It is pretty much the simpler form of C language. Arduino IDE all functions and libraries are written in C/C++. Also, we can use Java programming language to communicate with the Arduino board via serial port communication. But Java will just complicate things in Arduino. So, here We will learn how to create a project in Arduino using the C language.

Sketch − The Arduino program terminology is called “sketch”.

Arduino programming Language structure

The Arduino programming structure consists of two function, one is Setup( ) function, and another one is Loop( ) function

Arduino programming structure
Arduino programming structure
  • Setup( ) function

 The setup() function is called when a sketch starts. This function is used to initialize the variables, pin modes, start using libraries, etc. The setup() function will only run once, after power ON or RESET  the Arduino board.

  • Loop( ) function

After creating the setup() function, then the loop() function is called in the sketch. It is also mandatory in an Arduino program. The code inside the loop() function runs again and again. This function does precisely what its name suggests, and loops continuously, also it allowing to change the program and respond. This function is used to actively control the Arduino board.

Arduino LED Blinking Program

Every programming language has a basic code “Hello, World!”. But in Arduino programming, it is an “LED Blinking” code. You are getting this code in your Arduino IDE example section.

We are using this code to better understand Arduino programming. Using the Blink sketch, we will turn ON the LED for one second and turn it OFF for one second, it’s continually running. The Arduino board has a LED, that is connected to Pin 13 of the Arduino.

Also, we will connect an external LED to the Arduino pin 13, to show “how to connect a LED with Arduino”.

Components Required

Components Name Quantity
Arduino Uno Board (you can use other types of Arduino board like Arduino UNO, MEGA, pro mini, etc)1
USB cable for Arduino Uno1
330-ohm Resistor1
Connecting wireAs per required in the circuit diagram

Arduino LED Circuit Diagram

Arduino LED Circuit Diagram
Arduino LED Circuit Diagram

Circuit Wiring

LED PinArduino pin
LED positive (+) terminal connected to Arduino 13 pin through a 330-ohm resistor
LED negative (-) terminalconnected to Arduino GND pin

How To Program Arduino – LED Blinking Program/sketch (Arduino Programing)

At first, open your Arduino IDE software. Then open – File >> Example >> Basics >> Blink.

Arduino IDE LED Blinking example, Arduino Programing Language
Arduino IDE LED Blinking example

After following the above process, now you reach the blink LED example code window.

LED Blinking Program sketch
Arduino LED Blinking Program sketch

Before uploading the program to the Arduino board, we should “Verify or Compile” the code. Click on the first symbol of the Arduino IDE Menu Bar to “Verify or Compile” the code. Now, compiling is started.

IDE Verify or Compile Button
Arduino IDE Verify or Compile Button

After compiling, if your code has no error then you can see the “DONE Compiling” message on the Output panel of Arduino IDE.

DONE Compiling message
DONE Compiling message

Arduino Programing- Upload Code to Arduino Board

Now code is ready to upload in your Arduino board. First of all, connect the Arduino board to your computer using the USB cable.

Then go to the Arduino IDE “tool” section for select the “Board” and “port”. In my case Board is “Arduino UNO”, you can choose the Board type according to you Arduino and port is “COM6”, but your port may be different.

Arduino UNO Board select in Arduino IDE tool
Arduino UNO Board select in Arduino IDE tool
Arduino UNO Port select in Arduino IDE tool
Arduino UNO Port select in Arduino IDE tool

All important steps are completed. So, click on the “Upload” button. When uploading is successful you get the “Done Uploading” message on the Output panel of Arduino IDE.

How to Upload Code on Arduino Board
Upload Code on Arduino

Output Result

As a result, you can see Arduino LED and external LED turn ON for one second and turn OFF for one second, it’s continually running.

Share This

One thought on “Arduino Programing Language | How To Program Arduino

Leave a Reply

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