The fifty elements of the Arduino syntax can be seen here http://www.arduino.cc/en/Reference/HomePage as well as from the document
“Index.html” (in the “Reference” folder that you downloaded with Arduino), also accessible in the “Help” menu of the software.
Let’s take a closer look at the program on the previous page, which is used to flash an LED from a digital output:
Always write comments about the program: either
in multiline, by writing between / **** /, or on a
line of code separating from the code with //
Definition of variables
For our assembly, we will use a digital output of the card, which is for example the 13th digital output. This variable must be defined and named
here: we give it an arbitrary name BrocheLED. The syntax word is to denote an integer is int
Configuration of void setup () I / O
The digital pins of the Arduino can be configured as digital inputs or digital outputs as well. Here we will configure PinLED as output.
pinMode (name, state) is one of the four functions relating to digital I / O.
Programming void loop () interactions
In this loop, we define the operations to be performed, in order:
• digitalWrite (name, state) is another of the four functions relating to digital I / O.
• delay (time in milliseconds) is the wait command between two other instructions
• Each instruction line ends with a semicolon
• Don’t forget the braces, which frame the loop.
The figure below shows you an example of a well-structured program:
Don’t forget to leave a comment