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 functions block that we need in each and every program although both are empty. Because by default when we compile any program, compiler will search for these functions, if compiler does not find these, it will give us error. We will discuss what is compiler later.

In Arduino 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 Arduino (microcontroller).

GETTING START WITH ARDUINO

A sample is shown, which we will follow in our programming. Statements are instruction 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 execute line by line so after execution of statements in void setup() function once, execution of statements in void loop() function starts.

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

Read Next: Arduino IDE preference settings and a guided tour

Total Visits: 1687
0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Translate »
0
Would love your thoughts, please comment.x
()
x