Photo by Harrison Broadbent on Unsplash

Arduino language
The Arduino programming language essentially uses the C programming language. Language C itself is a very popular high-level language and is widely used by programmers. Thus the rules of writing and use of the Arduino language will be the same as the language C. To learn more about the programming language of Arduino and any commands in the Arduino programming language you can open the official Arduino Reference website or access it in the form of an android application you can download the Arduino Language Reference.
Structure Program
The basic Srtuktur Arduino programming language is very simple consisting of only two parts. These two sections can also be referred to as the main functions i.e. setup () and loop ().
void Setup ()

void Loop ()
where Setup () is a section for initialization that runs only once at the beginning of the program, while the Loop () to execute a part of the program will be executed repeatedly for good.
Setup ()
The setup () function is only called one time when the program was first executed. This is used to define PIN mode or initiate serial communication. The setup () function must be included in the program even if no statement is executed.
void Setup ()
pinMode (13, OUTPUT); Set ‘ pin ‘ to 13 as the output
Loop ()
After running the setup () function It will directly perform the loop () function in sequence and perform the instructions that are in the loop () function continuously.
void Loop ()
digitalWrite (13, HIGH); Turn on ‘ pin ‘ 13
Delay (1000); Pause for 1 second
digitalWrite (13, LOW); Turn off ‘ pin ‘ 13
Delay (1000); Pause for 1 second
Function is a block of programming that has a name and has a statement that will be executed when the function is called. The void setup () and void loop () functions are discussed above and the creation of the other functions will be discussed next.
Type functionName (Parameters)
int delayVal ()
int V; Create variable ‘ V ‘ with integer type
v = analogRead (pot); Read Potentiometer Price
V/= 4; Convert 0-1023 to 0-255
return v; return value V
In the example above the function has an int (integer) return, because if there is no need for a return value then the type function should void.
{} curly Braces
The Curly brace defines the beginning and end of a block function. If when programming and progremer forget to give a curly brace close then when compiling there will be an error report.
type function ()
; Semicolon
All statements written in block comments will not be executed and will not be compiled so it does not affect the large


int x = 13; Declares variable ‘ x ‘ as the integer 13
/*… */Block Comment
Semicolon should be given in each program statement that we make this is a delimiter every program statement made.
/* This is an enclosed block comment
Don’t forget the closing comment
They have to be balanced!
Line Comment
Similar to block comments, line coments are just the same as commenting is a row.
This is a single line comment
A Variable is a storage value that can be used in programs. Variables can be changed according to the instruction we make. When you declarify the variables should include the type variable and the initial variable value.
Type variableName = 0;
Defines a variable named inputVariable with an initial value of 0
int inputVariable = 0;

Save the existing value in analogue pin 2 to inputVariable
inputVariable = analogRead (2);
The Variable scope
A variable can be declared at the beginning of the program before void Setup (), locally in a function, and sometimes in a repeating block statement.

A global variable is only one and can be used in all block functions and statements within the program. Global variables are declared at the beginning of the program before the setup () function.

A local variable is declared in each block function or in each repeat block statement and can only be used on the corresponding block.

Usage Example:
int value; ‘ Value ‘ is a global variable and can be used on all block funtion

void Setup ()
No setup needed

void Loop ()
for (int i = 0; i < 20;)//’ I ‘ can only be used in repetition only
i + +;
float F; ‘ F ‘ as a variable local
Data type
Type bytes can store 8-bit numbers of the original number number of commas. Bytes have a range of 0 – 255.
biteVariable bytes = 160; Declare ‘ biteVariable ‘ as the type byte
Integer is the primary data type for storing integer values without commas. 16-bit integer storage with a range of 32,767 to-32,768.
int integerVariable = 1500; Declare ‘ integerVariable ‘ as the integer type
Expanded size to long integer, storage of long integers of 32-bit with a range of 2,147,483,647 to-2,147,483,648.
Long longVariable = 900000; Declaring ‘ longVariable ‘ as the type long
Float is a data type that can hold decimal value, float is a storage larger than integer and can store 32-bit with range 3.4028235 E + 38 to-3.4028235 E + 38.
float floatVariable = 3.14; Declare ‘ floatVariable ‘ as the type float

Photo by Spencer on Unsplash
Photo by Spencer on Unsplash

Array is a collection of values that can be accessed by the index number, the value contained in the array can be called by writing the array name and index number. The array with index 0 is the first value of the array. Arrays need to be declared and if necessary to rate before use.
int myArray [] = {value0, value1, value2…}
Example Usage array:
int myArray [] = {2, 4, 6, 8,10}
x = myArray [5]; X is now equal to 10
Operator aritmetic
Arithmetic operators consist of summation, subtraction, your multiplier, and division.
y = y + 3;
x = x-8;
i = i * 5;
R = r/9;
In using an arithmetic operand should be careful in determining the type of data used should not occur to overflow range data.
Compound assignments
Compound assignments is a combination of aritmatic with a variable. This is usually used on repetition.
x + +; Same as x = x + 1 or raise the x value by 1
X–; Same as x = x-1 or reduce the x value by 1
x + = y; Same as x = x + y
X-= y; Same as x = X – y
x * = y; Same as x = x * y
X/= y; Same as x = x/y
This Statement is two variables and if it is fulfilled, it will be 1 or true. This Statement is widely used in conditional operators.
x = = y; X equals y
X! = y; x not equal to Y
x < y; x bored Small of Y
x > y; x greater than Y
x < = y; x smaller than equal to Y
x > = y; x greater than equal to Y
Logic operators
Logical operators are used to compare two expression and return a true or incorrect reverse value depending on the operator being used. There are 3 logical AND, OR, and NOT operators, which are usually used in the IF statement.

Usage Example:

Logical AND
if (X > 0 & & x < 5) is properly valued when both comparator operators are met
Logical OR
if (x > 0 | | Y > 0) is properly valued when one of the comparator operators is met
Logical NOT
if (! x > 0) is correct if the operator expression is incorrect
Arduino has several variables already in the know that we call constants. This makes programming easier to read. Constants in the Kelasification by group.
It is a Boolean constant that finalised the logic level. False can be defined as 0 and True as 1.
if (b = = TRUE);
These constants are used to determine the pin condition at the HIGH or LOW levels when reading and writing from/to digital pins. HIGH is defined as logic 1, ON, or 5 volt while LOW is as logic 0, OFF, or 0 volt.
digitalWrite (13, HIGH);
This constant is used with the pinMode () function to finalized the digital pin mode, as INPUT or OUTPUT.
pinMode (13, OUTPUT);


Please enter your comment!
Please enter your name here