To write programs for the Arduino, we can use an integrated programming environment (IDE),that was developed by David Mellis and heavily influenced by Processing. This makes it particularly easy for us to get started - but there are a few differences when we are programming for a microcontroller. For Arduino we use a simplified variant of C / C ++. Since Arduino is based on Processing, the interface and syntax of both programs look very similar. The programming environment also looks very similar.
The basic structure of an arduino program always includes the setup () and loop () functions. Setup () is only called once when the program is started (either after transferring it to the board or after pressing the reset button). In this function, the pins are set as inputs or outputs, the serial interface is activated or external libraries are initialized. The loop () function runs continuously as long as the Arduino is switched on.
int (byte, int, uint, long, ulong)
A whole number
I.e. int x = 22;
float (double)
Floating Point number
I.e. float y = 1.234;
char
Character
I.e. char z = “a”;
String
A collection of characters
I.e. String testString = “Arduino”;
boolean
A binary variable
I.e. boolean state = false;
Arithmetic operators (+,-,*,/,=,%)
Comparison operators (,=,==,!=)
Boolean Operators (&&,||,!)
Compound operators (++,–,+=,-=,*=,/=)