z
Microprocessor
Systems
CT-318
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
1
z
Previous Topics
 Basic structures of Arduino Programming
setup()
loop()
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
2
z
Previous Topics
 {} curly braces
 ; semicolon
 /*… */ block comments
 // line comments
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
3
z
Previous Topics
 variables
 Datatypes
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
4
z
Set the pin 10 into redLED as global variable
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
5
z
Read the following terms….
 Arithmetic operators
 compound assignments
 comparison operators
 Boolean constants
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
6
z
Read the following terms….
 If statements
 if… else statements
 For loop
 While loop
 Do .. While loop
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
7
z
Checking of Assignments
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
8
z
Read the following terms….
 arithmetic
 compound assignments
 comparison operators
 logical operators
 constants values
 if statements
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
9
z
Read the following terms….
 if… else statement
 for statement
 while loop statement
 do… while statement
 pinMode(pin, mode)
 digitalRead(pin)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
10
z
Read the following terms….
 digitalWrite(pin, value)
 analogRead(pin)
 analogWrite(pin, value)
 delay(ms)
 millis()
 min(x, y)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
11
z
Read the following terms….
 max(x, y)
 randomSeed(seed)
 random(max)
 random(min, max)
 Serial.begin(rate)
 Serial.println(data)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
12
z
OBJECTIVES
At the end of this lesson, learners will be able to;
 summarize the arithmetic operators, compound assignments,
comparison operators, logical operators, and constant values;
 recognize the use of if statements, if… else statement, for statement ,
while loop statement, and do… while statement;
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
13
z
OBJECTIVES
At the end of this lesson, learners will be able to;
 sketch the constant values like pinMode(pin, mode), digitalRead(pin),
digitalWrite(pin, value), analogRead(pin), analogWrite(pin, value),
delay(ms), millis(), min(x, y), max(x, y), randomSeed(seed), random(max),
random(min, max), Serial.begin(rate), and Serial.println(data);
 analyze and design code structure, and;
 develop their problem-solving skills and use them in their future Arduino
projects to show innovativeness.
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
14
z
arithmetic
Arithmetic operators include addition,
subtraction, multiplication, and division.
They return the sum, difference, product,
or quotient (respectively) of two operands.
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
15
z
arithmetic
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
16
z
Arithmetic operators includes?
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
17
z
arithmetic
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
18
z
compound assignments
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
19
z
Enumerate the following.
x++ is the same as?
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
20
z
Enumerate the following.
x - - is the same as?
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
21
z
Enumerate the following.
x += y is the same as?
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
22
z
Enumerate the following.
x -= y is the same as?
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
23
z
Enumerate the following.
x *= y is the same as?
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
24
z
Enumerate the following.
x /= y is the same as?
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
25
z
comparison operators
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
26
z
Enumerate the following.
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
27
z
logical operators
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
28
z
Write the code on the board.
Logical AND
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
29
z
Write the code on the board.
Logical OR
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
30
z
Write the code on the board.
Logical NOT
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
31
z
constants
The Arduino language has a few
predefined values, which are called
constants. They are used to make the
programs easier to read. Constants are
classified in groups.
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
32
z
constants
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
33
z
In BOOLEAN, zero is defined as?
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
34
z
In BOOLEAN, TRUE is defined as?
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
35
z
constants
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
36
z
 HIGH is defined as?
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
37
z
 LOW is defined as?
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
38
z
Explain the code.
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
39
z
constants
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
40
z
Explain the code.
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
41
z
if statements
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
42
z
Explain the code.
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
43
z
if statements
The given example compares someVariable to
another value, which can be either a variable or
constant. If the comparison, or condition in
parentheses is true, the statements inside the
brackets are run. If not, the program skips over
them and continues on after the brackets.
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
44
z
if statements
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
45
z
if… else
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
46
z
if… else
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
47
z
if… else
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
48
z
Explain the code.
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
49
z
for statement
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
50
z
for statement
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
51
z
for statement
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
52
z
for statement
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
53
z
Explain each part of a “for statement”.
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
54
z
while loop
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
55
z
while loop
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
56
z
 What will happen if the expression
inside the parentheses becomes
false?
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
57
z
do… while
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
58
z
do… while
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
59
z
 What will happen if x is no longer
less than 100?
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
60
z
pinMode(pin, mode)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
61
z
pinMode(pin, mode)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
62
z
Write a code on the board.
 In void setup, set the pin 3 as an
output and in the void loop turn the
LED “on” using digital write.
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
63
z
pinMode(pin, mode)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
64
z
digitalRead(pin)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
65
z
digitalWrite(pin, value)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
66
z
digitalWrite(pin, value)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
67
z
Explain each line of code.
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
68
z
analogRead(pin)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
69
z
analogWrite(pin, value)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
70
z
analogWrite(pin, value)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
71
z
analogWrite(pin, value)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
72
z
delay(ms)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
73
z
millis()
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
74
z
min(x, y)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
75
z
max(x, y)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
76
z
randomSeed(seed)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
77
z
random(max)
random(min, max)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
78
z
random(max)
random(min, max)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
79
z
Serial.begin(rate)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
80
z
Serial.println(data)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
81
z
Serial.println(data)
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
82
z
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
83
z
Activity
On a ¼ clean yellow pad paper, write a code based
on this diagram. Please use a global variable.
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
84
z
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
85
z
MIDTERM HANDS-ON EXAM using
Serial Input from 0-5.
 Type 1 to turn on the yellow LED
 Type 2 to turn on the green LED
 Type 3 to turn on the red LED
 Type 4 to sequential blink LEDs
 Type 5 to turn on all LEDs
 Type 0 to turn off LEDs
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
86
z
Pseudo-code
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
87
z
Pseudo-code
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
88
z
Pseudo-code
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
89
z
references
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
90
z
Microprocessor
Systems
CT-318
11/23/2022
Lesson
3
-
LED
Display
PART
2
|
MIDTERM
|
Mark
John
P.
Lado,
MITc
91

PART 2 CT-318-Microprocessor-Systems Lesson 3 - LED Display by Mark John Lado.ppsx