Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Arduino program structure


May 15, 2021 Arduino


Table of contents


In this chapter, we will delve into the structure of the Arduino program and learn more about the new terms used in the Arduino world. /b10> Arduino software is open source. /b11> The source code for the Java environment is released under GPL, and the C/C?microcontroller library is under LGPL.


Sketch - The first new term is the Arduino program called Sketch.


Structure

The Arduino program can be divided into three main parts: structure, value (variables and constants), and functions. /b10> In this tutorial, we'll take a step-by-step look at arduino software programs and how to write them without any syntax or compilation errors.


Let's start with the structure. The software structure consists of two main functions:

  • Setup() function
  • Loop() function
Arduino program structure
Void setup ( ) {

}
  • PURPOSE - The setup() function is called when the sketch starts. /b10> Use it to initialize variables, pin mode, enable libraries, and more. T he setup function can only be run once after each power-up or reset of the Arduino board.

  • INPUT - -

  • OUTPUT - -

  • RETURN - -

Void Loop ( ) {

}
  • PURPOSE - After creating a setup() function for initializing and setting the initial value, the loop() function, as its name means, allows your program to continuously loop changes and responses. Y ou can use it to actively control the Arduino board.

  • INPUT - -

  • OUTPUT - -

  • RETURN - -