arduino introduction
TRANSCRIPT
![Page 1: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/1.jpg)
![Page 2: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/2.jpg)
![Page 3: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/3.jpg)
![Page 4: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/4.jpg)
![Page 5: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/5.jpg)
![Page 6: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/6.jpg)
![Page 7: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/7.jpg)
Digital Signal
Processors
General-purpose Microprocessors Microcontrollers
Microprocessors
8086, Pentium I-IV, Core-duo, Atom, Sparc,..
8051, PIC, ATMEGA, AVR,.. TMS320XX
AD21XX,…
Type of Microprocessors
![Page 8: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/8.jpg)
![Page 9: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/9.jpg)
![Page 10: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/10.jpg)
WHAT IS ARDUINO?
![Page 11: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/11.jpg)
Why invented the Arduino boards ?
![Page 12: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/12.jpg)
![Page 13: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/13.jpg)
![Page 14: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/14.jpg)
![Page 15: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/15.jpg)
![Page 16: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/16.jpg)
![Page 17: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/17.jpg)
![Page 18: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/18.jpg)
![Page 19: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/19.jpg)
![Page 20: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/20.jpg)
![Page 21: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/21.jpg)
Arduino shield
![Page 22: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/22.jpg)
GSM shield Arduino
![Page 23: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/23.jpg)
GPS shield Arduino
![Page 24: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/24.jpg)
![Page 25: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/25.jpg)
![Page 26: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/26.jpg)
![Page 27: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/27.jpg)
![Page 28: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/28.jpg)
![Page 29: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/29.jpg)
![Page 30: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/30.jpg)
![Page 31: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/31.jpg)
![Page 32: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/32.jpg)
![Page 33: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/33.jpg)
Programming
![Page 34: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/34.jpg)
![Page 35: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/35.jpg)
![Page 36: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/36.jpg)
Sketches
![Page 37: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/37.jpg)
![Page 38: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/38.jpg)
??
? ?
? ??
??
?
![Page 39: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/39.jpg)
Microcontroller
Arduino c
![Page 40: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/40.jpg)
C programming
![Page 41: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/41.jpg)
Important notes { } curly braces
Curly braces (also referred to as just "braces" or "curly brackets") define the beginning and end of
function blocks and statement blocks such as the void loop() function and the for and if statements.
Void Loop(){ Statements;}
![Page 42: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/42.jpg)
; semicolon A semicolon must be used to end a statement and separate
elements of the program. A semicolon is also used to separate elements in a for loop.
int x = 13; // declares variable 'x' as the integer 13
/*… */ block comments Block comments, or multi-line comments, are areas of text ignored
by the program and are used for large text descriptions of code or comments that help others understand parts of the program. They begin with /* and end with */ and can span multiple lines.
/* this is an enclosed block comment don’t forget the closing comment - they have to be balanced! */
![Page 43: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/43.jpg)
// line comments Single line comments begin with // and end with the next
line of code. Like block comments, they are ignored by the program and take no memory
space.
// this is a single line comment
Single line comments are often used after a valid statement to provide more information about what the statement
accomplishes or to provide a future reminder.
![Page 44: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/44.jpg)
![Page 45: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/45.jpg)
boolean (0, 1, false, true) char (e.g. ‘a’ -128 to 127) unsigned char (0 to 255)
byte (0 to 255) int (-32,768 to 32,767) unsigned int (0 to 65535)
word (0 to 65535) long (-2,147,483,648 to 2,147,483,648
unsigned long (0 to 4,294,967,295)
float -(3.4028235E+38 to
3.4028235E+38)double (currently same
as float)sizeof(myint) // returns 2
bytes
![Page 46: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/46.jpg)
![Page 47: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/47.jpg)
General Operators= (assignment operator)
+ (addition) - (subtraction)
(multiplication) */ (division)% (modulo)
== (equal to) != (not equal to)< (less than) > (greater than)
<= (less than or equal to)>= (greater than or equal to)
&& (and) || (or) ! (not)
![Page 48: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/48.jpg)
x ++ // same as x = x + 1, or increments x by +1
x -- // same as x = x - 1, or decrements x by -1
x += y // same as x = x + y, or increments x by +y
x -= y // same as x = x - y, or decrements x by -y
x *= y // same as x = x * y, or multiplies x by y
x /= y // same as x = x / y, or divides x by y
![Page 49: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/49.jpg)
Arduino c
C programming
Arduino c
C programming
![Page 50: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/50.jpg)
![Page 51: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/51.jpg)
![Page 52: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/52.jpg)
Lecture 2
![Page 53: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/53.jpg)
Microcontroller
Arduino c
![Page 54: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/54.jpg)
C programming
![Page 55: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/55.jpg)
Important notes { } curly braces
Define the beginning and end of function blocks and statement blocks such as the void loop() function and the for and if statements.
Void Loop(){ Statement;Statement;
}
![Page 56: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/56.jpg)
; semicolon A semicolon must be used to end a statement and separate
elements of the program. A semicolon is also used to separate elements in a for loop.
int x = 13; // declares variable 'x' as the integer 13
/*… */ block comments Block comments, or multi-line comments, are areas of text ignored
by the program and are used for large text descriptions of code or comments that help others understand parts of the program. They begin with /* and end with */ and can span multiple lines.
/* this is an enclosed block comment don’t forget the closing comment - they have to be balanced! */
![Page 57: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/57.jpg)
// line comments Single line comments begin with // and end with the next
line of code. Like block comments, they are ignored by the program and take no memory
space.
// this is a single line comment
Single line comments are often used after a valid statement to provide more information about what the statement
accomplishes or to provide a future reminder.
![Page 58: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/58.jpg)
![Page 59: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/59.jpg)
boolean (0, 1, false, true) char (e.g. ‘a’ -128 to 127) unsigned char (0 to 255)
byte (0 to 255) int (-32,768 to 32,767) unsigned int (0 to 65535)
word (0 to 65535) long (-2,147,483,648 to 2,147,483,648
unsigned long (0 to 4,294,967,295)
float -(3.4028235E+38 to
3.4028235E+38)double (currently same
as float)sizeof(myint) // returns 2
bytes
![Page 60: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/60.jpg)
General Operators= (assignment operator)
+ (addition) - (subtraction)
(multiplication) */ (division)% (modulo)
== (equal to) != (not equal to)< (less than) > (greater than)
<= (less than or equal to)>= (greater than or equal to)
&& (and) || (or) ! (not)
![Page 61: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/61.jpg)
Code Structures
![Page 62: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/62.jpg)
![Page 63: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/63.jpg)
Control statements • If statement • Switch case statement • While statement • Do …. While statement • For statement
![Page 64: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/64.jpg)
• If statement • Switch case statement
• While statement • Do …. While statement • For statement
![Page 65: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/65.jpg)
If statement One way selection
Example
If (score >= 60) grade = ‘P’ ;else grade = ‘F’ ;
Example
Two way selection
Multiple selections
Example
![Page 66: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/66.jpg)
Important notes { } curly braces
Define the beginning and end of function blocks and statement blocks such as the void loop() function and the for and if statements.
Void Loop(){ Statement;Statement;
}
![Page 67: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/67.jpg)
Compound statement (block of statements):
if (age > 18){
cout << "Eligible to vote." << endl;cout << "No longer a minor." << endl;
} else{
cout << "Not eligible to vote." << endl;cout << "Still a minor." << endl;
}
Example
![Page 68: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/68.jpg)
Switch case statement switch structure
Example
![Page 69: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/69.jpg)
• If statement • Switch case statement
• While statement • Do …. While statement • For statement
![Page 70: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/70.jpg)
Example
• while Looping (Repetition) • do…while Looping (Repetition) Structure (continued)
Example
![Page 71: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/71.jpg)
![Page 72: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/72.jpg)
For statement
![Page 73: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/73.jpg)
Infinite loop using while and for
for (;;)cout << "Hello" << endl;
While(1){cout << "Hello" << endl;}
![Page 74: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/74.jpg)
Arduino c
C programming
Arduino c
C programming
![Page 75: Arduino introduction](https://reader035.vdocument.in/reader035/viewer/2022081422/58f0526c1a28abb4118b45e9/html5/thumbnails/75.jpg)