0% found this document useful (0 votes)
17 views

Arduino: Session3 (Week1) .

content: 1- Potentiometer. 2- Mapping. 3- Loops. 4- Seven-segments display. 5- Functions.

Uploaded by

hamdhwas6
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Arduino: Session3 (Week1) .

content: 1- Potentiometer. 2- Mapping. 3- Loops. 4- Seven-segments display. 5- Functions.

Uploaded by

hamdhwas6
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 46

Mansoura

Robotics
About Me
Mohamed Hamed :
►Computers and control systems
department.

► Mansoura robotics team


member.

► Arduino subteam.
Hackathon
7.0 ►
Arduino
Session 3
Mansoura Robotics
► agenda
① Mapping and potentiometer.
⇛ LAB
② looping. 1
⇛ LAB
③ 7_Segment Displays. 2
⇛ LAB
3
④ Functions.
⇛ Mapping
Mappin
◐ Mapping
g ℃ ℉
0℃ ( 0 ℃ X 1.8 ) + 32 ℉

20 ℃ ( 20 ℃ X 1.8 ) + 32 ℉

80 ℃ ( 80 ℃ X 1.8 ) + 32 ℉

100 ( 100 ℃ X 1.8 ) + 32 ℉



Mappin
g Given ℉ Divisions

℃ ℉
0℃ 32 ℉ ℉ map (℃ , 0 , 100 , 32 ,
100 ℃ 212 212 ) ;
℉ ℃
Divisions
⇛ potentiometer
VCC

GND
Signal
Potentiometer

⇛ The way to connect


with
Arduino :
▶ LAB 1
◔ LAB 1
◔ LAB 1
⇛ Looping
Looping
Looping

Condition

decrement

x--;
Looping
Looping
Looping
Looping

}
▶ LAB 2
Lab (2)
Lab (2)
⇛ 7_Segment
Displays.
7-Segment
7-Segment common Cathode
7-Segment common ANODE
7-Segment
7-Segment
7-Segment
7-Segment
7-Segment
7-Segment
▶ LAB 3
Lab (3)
⇛ Functions
Functions
• A program segment that carries out some specific, well-
defined task
Example
A function to add two numbers
A function to find the largest of n numbers
• A function will carry out its intended task whenever it is
called or invoked
Can be called multiple times
FUNCTIONS
Why
Functions?
• Allows one to develop a program in a modular
fashion
• Divide-and-conquer approach
• Construct a program from small pieces or
components
• Use existing functions as building blocks for new
programs
• Abstraction: hide internal details (library functions)

39
FUNCTIONS
⇛ Defining a Function
A function definition has two parts:
The first line, called header
The body of the function
return-value-type function-name ( parameter-list )
{
declarations and statements
}

40
FUNCTIONS

• The first line contains the return-value-type, the function


name, and optionally a set of comma-separated
arguments enclosed in parentheses
• Each argument has an associated type declaration
• The arguments are called formal arguments or formal
parameters
• The body of the function is actually a block of statement
that defines the action to be taken by the function

41
Calling function (Caller)
Called function (Callee) parameter

Parameter passed

Calling/Invoking the cent2fahr function Returning value


42
FUNCTIONS
⇛ Example 1

43
FUNCTIONS
⇛ Example 2

44
⇛ Next Session :

⇛ Motors
Thank you

You might also like