Programming of Arduino (Arduino Series - Part 02)


In this chapter, we will study in depth, the Arduino program structure and we will learn more new terminologies used in the Arduino world. The Arduino software is open-source. The source code for the Java environment is released under the GPL and the C/C++ microcontroller libraries are under the LGPL.
Sketch − The first new terminology is the Arduino program called “sketch”.
Structure: 
Arduino programs can be divided in three main parts:


1. define: 



Since there are 14 Digital Pins and 6 Analog Pins in Arduino UNO, we have to define that which are the pins among them that we are going to use in the project.



In order to define a pin we have to write



#define led 13



Here, led is a variable given to Digital Pin 13.

2. void setup()

Whatever we write in void setup() that part runs just for a once in Arduino. Hence, here we have to define the pins as our INPUT or OUTPUT.

For Example:

void setup()
{
      pinMode(13, OUTPUT);
}


3. void loop()

void loop() is the most important part of programming. Whatever we write in void loop gets repeated again and again. Hence whatever we want to do with Arduino that thing should be written in void loop().

Example: if I wan to just turn on led.

void loop()
{
     digitalWrite(led, HIGH);
}



Click below to watch full Tutorial video on it:


Comments

  1. Lifi project app .aia file please bro send to @bhageshwars3@gmail.com

    ReplyDelete

Post a Comment

Popular

How to interface Ultrasonic sensor with Arduino UNO (Arduino Series - Part 05)

How to Make Call, Send and Receive Message using GSM Module

Bidirectional Visitor Counter Project with Arduino UNO