Arduino                                                          Home : www.sharetechnote.com

 

 

 

 

Arduino - Programming

 

In this page, I will explain on progamming Arduino using Arduino IDE and describe mostly on functions that you would use in Arduino Sketch file. You would have a lot of information on this from Arduino Tutorial page and the contents of this page would not be much different from what you get from Arduino homepage, but I will reorgnize and describe things so that you can use as a kind of quick cheatsheet.

 

 

 

Basic Structure

 

Every computer language has its own structure. Arduino also has its own structure as shown below. Basically it is made up of three sections. You will see these three sections in every Arduino program that is called Sketch.

 

Section 1 : Global Variable Declaration

 

This section is located at the beginning of the program. This is where you can define variables (global variables) that you will use at later part of the program. In case when you don't need any global variable, this part would be left empty.

 

 

Section 2 : Initialization

 

This part is defined as a function named as 'setup()' and this is the function that is executed at first when you run Arduino program and this functions is excuted only once. So usually you would put down the code that needs to be done before the main body (loop()) is executed.

    void setup() {

      ....

    }

 

 

Section 3 : Main Body

 

This is the main body of the program (it is like main() in C language). As the function name implies, this function keep repeating once it starts.

    void loop() {

       ....

    }

 

 

Build and Upload  Process