Basic Structure of Arduino Programming | Setup & Loop Function

The basic structure of the Arduino programming language is predefined and fairly simple. It runs in at least two parts. These two required parts, or functions, enclose blocks of statements.

Arduino official Logo

This is Basic Structure of Every Arduino Program

void setup()
}void loop()

Where setup() is the preparation, loop() is the execution. Both functions are required for the program to work.

The setup function should follow the declaration of any variables at the very beginning of the program. It is the first function to run in the program, is run only once, and is used to set pinMode or initialize serial communication.

The loop function follows next and includes the code to be executed continuously – reading inputs, triggering outputs, etc. This function is the core of all Arduino programs and does the bulk of the work.

So this is the primitive or basic structure of an Arduino Program.

Leave a Reply

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