Arduino
an Introduction
Eng. : Mohamed ElKenany
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
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
}
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 ;
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
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
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.
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
Contoso
S u i t e s
9
Data type:-
Contoso
S u i t e s
10
Input :-
Contoso
S u i t e s
11
Input :-
Thank You
Mohamed El-Kenany
01094997870
muhamed.abdelghaffar@gmail.com

Arduino lec 2

  • 1.
  • 2.
    Contoso S u it 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 it 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 it 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 it 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 it 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 it 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 it 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
  • 9.
    Contoso S u it e s 9 Data type:-
  • 10.
    Contoso S u it e s 10 Input :-
  • 11.
    Contoso S u it e s 11 Input :-
  • 12.