SlideShare une entreprise Scribd logo
1  sur  75
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
WHAT IS ARDUINO?
Why invented the Arduino boards ?
Arduino shield
GSM shield Arduino
GPS shield Arduino
Programming
Sketches
?
?
? ?
? ?
?
?
?
?
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;
}
; 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!
/*
// 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.
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
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)
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
Lecture 2
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;
}
; 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!
/*
// 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.
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
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)
Code Structures
Control statements
• If statement
• Switch case statement
• While statement
• Do …. While statement
• For statement
• If statement
• Switch case statement
• While statement
• Do …. While statement
• For statement
If statement
One way selection
Example
If (score >= 60)
grade = ‘P’ ;
else
grade = ‘F’ ;
Example
Two way selection
Multiple selections
Example
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;
}
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
Switch case statement
switch structure
Example
• If statement
• Switch case statement
• While statement
• Do …. While statement
• For statement
Example
• while Looping (Repetition)
• do…while Looping (Repetition) Structure (continued)
Example
For statement
Infinite loop using while and for
for (;;)
cout << "Hello" << endl;
While(1)
{cout << "Hello" << endl;}
Arduino introduction
Arduino introduction

Contenu connexe

Tendances

Tendances (12)

Chapter 1 nested control structures
Chapter 1 nested control structuresChapter 1 nested control structures
Chapter 1 nested control structures
 
C programming part4
C programming part4C programming part4
C programming part4
 
Ch3 selection
Ch3 selectionCh3 selection
Ch3 selection
 
Assignment
AssignmentAssignment
Assignment
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHON
 
Cg
CgCg
Cg
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
 
Ch3 Formatted Input/Output
Ch3 Formatted Input/OutputCh3 Formatted Input/Output
Ch3 Formatted Input/Output
 
line clipping
line clipping line clipping
line clipping
 
C programming session8
C programming  session8C programming  session8
C programming session8
 
OXUS20 JAVA Programming Questions and Answers PART I
OXUS20 JAVA Programming Questions and Answers PART IOXUS20 JAVA Programming Questions and Answers PART I
OXUS20 JAVA Programming Questions and Answers PART I
 
COM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & BranchingCOM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & Branching
 

En vedette

Chapter 2 Probabilty And Distribution
Chapter 2 Probabilty And DistributionChapter 2 Probabilty And Distribution
Chapter 2 Probabilty And Distribution
ghalan
 
Machine Learning Preliminaries and Math Refresher
Machine Learning Preliminaries and Math RefresherMachine Learning Preliminaries and Math Refresher
Machine Learning Preliminaries and Math Refresher
butest
 
Доклад Амро
Доклад АмроДоклад Амро
Доклад Амро
Amr Al-Awamry
 
Microwave Devices Lecture04
Microwave Devices Lecture04Microwave Devices Lecture04
Microwave Devices Lecture04
Amr Al-Awamry
 
Microwave Devices Lecture06
Microwave Devices Lecture06Microwave Devices Lecture06
Microwave Devices Lecture06
Amr Al-Awamry
 
Probability And Stats Intro
Probability And Stats IntroProbability And Stats Intro
Probability And Stats Intro
mailund
 
Microwave Devices Lecture08
Microwave Devices Lecture08Microwave Devices Lecture08
Microwave Devices Lecture08
Amr Al-Awamry
 
Microwave Devices Lecture09
Microwave Devices Lecture09Microwave Devices Lecture09
Microwave Devices Lecture09
Amr Al-Awamry
 
Microwave Devices Lecture13
Microwave Devices Lecture13Microwave Devices Lecture13
Microwave Devices Lecture13
Amr Al-Awamry
 
Microwave Devices Lecture03
Microwave Devices Lecture03Microwave Devices Lecture03
Microwave Devices Lecture03
Amr Al-Awamry
 
Microwave Devices Lecture12
Microwave Devices Lecture12Microwave Devices Lecture12
Microwave Devices Lecture12
Amr Al-Awamry
 

En vedette (20)

communication system Introduction - AM
communication system Introduction - AMcommunication system Introduction - AM
communication system Introduction - AM
 
Chapter 2 Probabilty And Distribution
Chapter 2 Probabilty And DistributionChapter 2 Probabilty And Distribution
Chapter 2 Probabilty And Distribution
 
Machine Learning Preliminaries and Math Refresher
Machine Learning Preliminaries and Math RefresherMachine Learning Preliminaries and Math Refresher
Machine Learning Preliminaries and Math Refresher
 
OpenPump: open-source hardware for medical devices
OpenPump: open-source hardware  for medical devicesOpenPump: open-source hardware  for medical devices
OpenPump: open-source hardware for medical devices
 
Droidcon 2013 france - The Growth of Android in Embedded Systems
Droidcon 2013 france - The Growth of Android in Embedded SystemsDroidcon 2013 france - The Growth of Android in Embedded Systems
Droidcon 2013 france - The Growth of Android in Embedded Systems
 
Доклад Амро
Доклад АмроДоклад Амро
Доклад Амро
 
Microwave Devices Lecture04
Microwave Devices Lecture04Microwave Devices Lecture04
Microwave Devices Lecture04
 
Microwave Devices Lecture06
Microwave Devices Lecture06Microwave Devices Lecture06
Microwave Devices Lecture06
 
Probability And Stats Intro
Probability And Stats IntroProbability And Stats Intro
Probability And Stats Intro
 
Microwave Devices Lecture08
Microwave Devices Lecture08Microwave Devices Lecture08
Microwave Devices Lecture08
 
Microwave Devices Lecture09
Microwave Devices Lecture09Microwave Devices Lecture09
Microwave Devices Lecture09
 
Microwave Devices Lecture13
Microwave Devices Lecture13Microwave Devices Lecture13
Microwave Devices Lecture13
 
Microwave Devices Lecture03
Microwave Devices Lecture03Microwave Devices Lecture03
Microwave Devices Lecture03
 
Timer & Interrupt Atmega16
Timer & Interrupt Atmega16Timer & Interrupt Atmega16
Timer & Interrupt Atmega16
 
Microwave engineering ch1
Microwave engineering ch1Microwave engineering ch1
Microwave engineering ch1
 
Filter design1
Filter design1Filter design1
Filter design1
 
8 habits
8 habits8 habits
8 habits
 
8086
80868086
8086
 
Microwave Devices Lecture12
Microwave Devices Lecture12Microwave Devices Lecture12
Microwave Devices Lecture12
 
AVR_Course_Day7 timers counters and interrupt programming
AVR_Course_Day7 timers counters and  interrupt programmingAVR_Course_Day7 timers counters and  interrupt programming
AVR_Course_Day7 timers counters and interrupt programming
 

Similaire à Arduino introduction

[Apostila] programação arduíno brian w. evans
[Apostila] programação arduíno   brian w. evans[Apostila] programação arduíno   brian w. evans
[Apostila] programação arduíno brian w. evans
Web-Desegner
 
EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5
PRADEEP
 

Similaire à Arduino introduction (20)

Introduction to C Language - Version 1.0 by Mark John Lado
Introduction to C Language - Version 1.0 by Mark John LadoIntroduction to C Language - Version 1.0 by Mark John Lado
Introduction to C Language - Version 1.0 by Mark John Lado
 
CSL101_Ch1.ppt
CSL101_Ch1.pptCSL101_Ch1.ppt
CSL101_Ch1.ppt
 
CSL101_Ch1.ppt
CSL101_Ch1.pptCSL101_Ch1.ppt
CSL101_Ch1.ppt
 
CSL101_Ch1.pptx
CSL101_Ch1.pptxCSL101_Ch1.pptx
CSL101_Ch1.pptx
 
CSL101_Ch1.pptx
CSL101_Ch1.pptxCSL101_Ch1.pptx
CSL101_Ch1.pptx
 
[Apostila] programação arduíno brian w. evans
[Apostila] programação arduíno   brian w. evans[Apostila] programação arduíno   brian w. evans
[Apostila] programação arduíno brian w. evans
 
EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5
 
0.my book draft chap 1
0.my book draft chap 10.my book draft chap 1
0.my book draft chap 1
 
Verilog presentation final
Verilog presentation finalVerilog presentation final
Verilog presentation final
 
a basic java programming and data type.ppt
a basic java programming and data type.ppta basic java programming and data type.ppt
a basic java programming and data type.ppt
 
06 chapter03 04_control_logix_tags_memory_structure_fa16
06 chapter03 04_control_logix_tags_memory_structure_fa1606 chapter03 04_control_logix_tags_memory_structure_fa16
06 chapter03 04_control_logix_tags_memory_structure_fa16
 
control statements
control statementscontrol statements
control statements
 
Basic Coding In VHDL COding
Basic Coding In VHDL COdingBasic Coding In VHDL COding
Basic Coding In VHDL COding
 
Interesting facts on c
Interesting facts on cInteresting facts on c
Interesting facts on c
 
c_tutorial_2.ppt
c_tutorial_2.pptc_tutorial_2.ppt
c_tutorial_2.ppt
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
 
C tutorial
C tutorialC tutorial
C tutorial
 
C tutorial
C tutorialC tutorial
C tutorial
 

Dernier

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
Tonystark477637
 

Dernier (20)

UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 

Arduino introduction

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. 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
  • 8.
  • 9.
  • 11. Why invented the Arduino boards ?
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 34.
  • 35.
  • 37.
  • 39.
  • 40.
  • 41. 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; }
  • 42. ; 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! /*
  • 43. // 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.
  • 44.
  • 45. 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
  • 46.
  • 47. 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)
  • 48. 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
  • 49.
  • 50.
  • 51.
  • 53.
  • 54.
  • 55. 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; }
  • 56. ; 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! /*
  • 57. // 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.
  • 58.
  • 59. 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
  • 60. 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)
  • 62.
  • 63. Control statements • If statement • Switch case statement • While statement • Do …. While statement • For statement
  • 64. • If statement • Switch case statement • While statement • Do …. While statement • For statement
  • 65. If statement One way selection Example If (score >= 60) grade = ‘P’ ; else grade = ‘F’ ; Example Two way selection Multiple selections Example
  • 66. 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; }
  • 67. 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
  • 68. Switch case statement switch structure Example
  • 69. • If statement • Switch case statement • While statement • Do …. While statement • For statement
  • 70. Example • while Looping (Repetition) • do…while Looping (Repetition) Structure (continued) Example
  • 71.
  • 73. Infinite loop using while and for for (;;) cout << "Hello" << endl; While(1) {cout << "Hello" << endl;}