2. Contoso
S u i t e s
2
A microcontroller board, contains on-board power supply, USB port to
communicate with PC, and an Atmel microcontroller chip
Arduino:-
It simplify the process of creating any control
system by providing the standard board that
can be programmed and connected to the system
without the need to any sophisticated PCB design
and implementation
It is an open source hardware, any one can
get the details of its design and modify it or
make his own one himself
3. Contoso
S u i t e s
3
Data type:-
Used for declaring variables or functions of different types.
The type of a variable determines how much space it occupies in the storage
and how the bit pattern stored is interpreted
Void
Only in function declarations indicates that the function return no information
EX : Void Loop ( )
{ // rest of the code
}
4. Contoso
S u i t e s
4
Data type:-
Boolean
one of two values, true or false. Each Boolean variable occupies one byte of
memory.
EX : boolean val = false
boolean state = true ;
Char
Takes up one byte of memory
stores a character value
(Char) single quotes ‘A’
(strings) double quotes: "ABC"
EX : Char chr_a = ‘a’
Char chr_c = 97 ;
5. Contoso
S u i t e s
5
Data type:-
unsigned char
unsigned data type that occupies one byte of memory
The unsigned char data type encodes numbers from 0 to 255.
EX :
byte
A byte stores an 8-bit unsigned number, from 0 to 255.
EX :
Unsigned Char chr = 121 ;
byte var = 25 ;
Int
EX : Int var = 50 ; The primary data-type for number storage.
Int stores a 16-bit (2-byte) value ,This yields
a range of -32,768 to 32,767
The int size varies from board to board
int counter = 32
6. Contoso
S u i t e s
6
Data type:-
Unsigned int
store a 2 byte value.
Instead of storing negative numbers,, only store positive values,
yielding a useful range of 0 to 65,535 (2^16) - 1)..
EX : Unsigned int var = 121 ;
Word
EX : Word var = 100 ;
stores a 16-bit unsigned number.
On the Due and Zero, it stores a 32-bit unsigned number
int counter = 32
Long
EX : Long var = 554 ;
store 32 bits (4 bytes), from -2,147,483,648 to
7. Contoso
S u i t e s
7
Data type:-
Unsigned Long
Number storage and store 32 bits (4 bytes).
range from 0 to 4,294,967,295 (2^32 - 1).
EX : Unsigned long var = 545 ;
Short
EX : Short var = 82 ;
short is a 16-bit data-type (2-byte) value.
Range from -32,768 to 32,767.
int counter = 32
float
EX : float var = 52.54 ;
Data type for floating-point number is a number that has a decimal point.
used to approximate the analog and continuous values
They are stored as 32 bits (4 bytes) of information.
8. Contoso
S u i t e s
8
Data type:-
Double
Double precision floating-point number occupies four bytes.
exactly the same as the float.
On the Arduino Due, doubles have 8-byte (64 bit) precision.
EX : Double var = 545.21 ;
int counter = 32