Getting Start with Arduino

If you want to start with Arduino you are at right place. Here you will see sample program needed in Arduino IDE and then on next page, you learn some settings requirement in Arduino IDE. Then how to save, compile or verifyupload etc.

SAMPLE PROGRAMMING SYNTAX

When you open Arduino IDE then you will see a window like this, and two function blocks void setup() and void loop().

These are the important function blocks that we need in each and every program although both are empty. Because by default when we compile any program, the compiler will search for these functions, if the compiler does not find these, it will give us error. We will discuss what a compiler is later.

In Arduino IDE the Program file is known as sketch and the file saved with the extension “ino”, for example – test.ino, example.ino, blink.ino etc.

demo Arduino program

Arduino programming is based on C and C++ programming language concepts. As we write programming code, we need to do two things – first to check the syntax, which we will do by verify (compiling) the sketch (file), second we will upload (run/burn) the sketch (file) in an Arduino (microcontroller).

GETTING START WITH ARDUINO

A sample is shown, which we will follow in our programming. Statements are instructions which we will write like pinMode(), digitalWrite(), Serial.print() etc.

void setup() {
  //we will write code here
  //code in setup runs only once
  Statement1;
  Statement 2;
}
void loop() {
  //we will write code here also but
  //code in loop will run repeatedly
  Statement1;
  Statement 2;
}

Because we know code will get executed line by line so after execution of statements in void setup() function once, execution of statements in void loop() function starts.

After the execution of the last statement of the loop we don’t want the microcontroller to be stopped so we write our main code in loop to repeat endlessly

Read Next: Arduino IDE preference settings and a guided tour

5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x