Arduino Programing
Arduino Programing
1). void setup ( ) :- setup () is a function. Void is a command by using that we declare an
Function.
With the every function after that a open-bracket ‘(’ and close-bracket ‘)’ exist.
In void setup(), the functions executed by Arduino is one time only. But, In void loop(),
the function executed by Arduino repeatedly again and again.
NOTE:-
In Arduino, program run in linear pattern / fashion.
Curley Brackets { }, used after void setup() and void loop() to show that program start
and end up here.
In Arduino, program is case-sensitive.
In Arduino, we use ‘ // ’ double slash to show or add comment in program.
We put ‘ ; ’ semi-colon after every statement in program.
2). Variables :- Variables are used to store information to be reference and manipulated in a
computer program.
There are 3-things are required to declare a variable:-
1. Data Type :– It is show that which of the Data is like Numeric, Word, Letter, etc.
2. Variable Name :– Like we put in program i.e. “ int_value_=10; ” ‘int’ is a Data Type
(integer), ‘Value’ is a variable name, ‘10’ is the Value assign to it.
3. Value:- It is a value which is assign to any variable. Like show in above example.
2 3 4 5 6 7
Data in Array
Program :- int val [6] = {2,3,4,5,6,7}; string val [ ] = {“apple”, “mango”, “banana”};
void setup ( ) void setup ( )
{ serial.begin(9600); { serial.begin(9600);
serial.print(val[1]); } serial.print(val[2]); }
void loop ( ) void loop ( )
{ } { }
15). Creating Functions:- Creating your own functions allows you to organize your code into
smaller chunks and treat complicated tasks as a single step.
void setup( )
{ myFunction();
delay(1000); }
void loop( )
{ myFunction(); }