
Arduino Exam Revision 2
Presentation
•
Computers
•
7th - 12th Grade
•
Medium
Bayden Schellein
Used 1+ times
FREE Resource
17 Slides • 16 Questions
1
2
Digital Pins
pinMode(13, OUTPUT);
This function is used to define digital pin
working behaviour. Digital pins are
defined as an input (INPUT) or an output
(OUTPUT).
In the example above you can see
brackets containing two parameters: the
variable (ledPin) and its behaviour
(OUTPUT).
3
pinMode
“pinMode” configures the specified
digital pin to behave either as an
input or an output.
It has two parameters:
“pin”: the number of the pin whose
mode you wish to set.
“mode”: INPUT, OUTPUT, or
INPUT_PULLUP.
4
DigitalWrite
The loop uses another function called
digitalWrite();
digitalWrite writes a HIGH (on) or a LOW (off)
value to a digital pin.
If the pin has been configured as an OUTPUT
with pinMode(), its voltage will be set to the
corresponding value: 5V (or 3.3V on 3.3V
boards) for HIGH and 0V (ground) for LOW.
In other words, by writing HIGH we turn on
the thing connected to that pin by sending it
power, and turn it off by writing LOW.
5
Multiple Choice
What is the correct pinMode setup code for this circuit?
pinMode(12, OUTPUT);
pinMode(8, INPUT);
pinMode(8, OUTPUT);
pinMode(7, INPUT);
6
Multiple Choice
If coded correctly, would the following circuit function?
Yes
No
7
Multiple Choice
void setup()
{
pinMode(13, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH); delay(1000);
digitalWrite(13, LOW); delay(1000);
}
8
Multiple Choice
Which command will turn the LED Off?
void setup()
{
pinMode(13, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH); delay(1000);
digitalWrite(13, LOW); delay(1000);
}
9
Hotspot
This code has two errors in it. It should turn on an LED in pin 13 for 150ms. Point to the two errors.
10
Typically, LEDs have two leads, one positive and one negative. There are two ways to tell which is the positive lead of the LED and which the negative: Firstly, the positive lead is longer. Secondly, where the negative lead enters the body of the LED, there is a flat edge to the case of the LED.
11
LED's (Light Emitting Diodes) are polarised so they have to be connected the right way around. If you put the negative lead of an LED in to the power supply and the positive lead to ground, the component will not work, as can be seen in the diagram to the right.
12
As the name suggests, resistors resist the flow of electricity. The higher the value of the resistor, the more resistance it has and the less electrical current will flow through it. The unit of resistance is called the Ohm, which is usually shortened to Ω( The geek letter Omega).
13
Generally no. In most simple circuits all the components will be in what is called a series, where all components share the same voltage and current.
This means it does not matter if a resistor is placed before or after an LED (for example).
However, in most cases the resistor is placed before the LED to simplify circuit designs.
14
Multiple Choice
Would this circuit work if coded correctly?
Yes
No
15
Multiple Choice
Would this circuit, if coded correctly, work?
Yes
No
16
Multiple Choice
Would this circuit, if coded correctly, work?
Yes
No
17
Open Ended
This board should light up all the LEDs, but it does not. There are two issues.
Explain what each issue is and how to fix it.
18
Loops and Stuff
The arduino code has two sections:
VoidSetup - this runs once and contains any setup code like what pins we are using and what we are doing with them
VoidLoop - this run continually over and over again. it contains our main code.
19
The “for” statement is used to repeat a block of statements enclosed in brackets for a set number of repetitions.
An increment counter is usually used to go through each loop and stop the loop.
There are four parts to the ‘for’ loop. Each is separated by a semicolon (;).
20
Multiple Choice
What is the primary purpose of using loops in programming?
To execute a set of instructions only once
To repeat a set of instructions multiple times until a condition is met
To store multiple values in a single variable
To increase the speed of the processor
21
22
Example
The variable i starts at 0 and counts, adding 1 to i after each loop until it is 5 or more, at which point the loop stops.
23
There are several to track a loop and control it.
This done with the variable and operators.
Operators are ways to change a variable with math.
24
The top picture shows a list math operations the loop can check for.
The bottom picture shows a list of operators we can use for our increments.
25
Example
The variable i starts at 0 and counts, adding 1 to i after each loop until it is 5 or more, at which point the loop stops.
26
Multiple Choice
How many times will the shown for loop execute?
0
9
10
11
27
The top picture shows a list math operations the loop can check for.
The bottom picture shows a list of operators we can use for our increments.
28
Multiple Choice
What will the code do?
Print "Loop iteration!" only once
Print "Loop iteration!" three times
Run forever and print "Loop iteration!" continuously
Cause an error because loop() is empty
29
The top picture shows a list math operations the loop can check for.
The bottom picture shows a list of operators we can use for our increments.
30
Fill in the Blanks
What will this code print out?
Type in the sequence with only spaces in between the numbers.
31
Fill in the Blanks
What will this code print out?
Type in the sequence with only spaces in between the numbers.
32
Drag and Drop
for (int
33
Open Ended
This code has an issue.
1) find the issue and explain what it is
2) suggest a fix and explain why it will work.
Show answer
Auto Play
Slide 1 / 33
SLIDE
Similar Resources on Wayground
30 questions
Peramban dan Search Engine (TIK/Informatika)
Presentation
•
KG - University
25 questions
Mechanical advantage of simple Machines
Presentation
•
6th - 12th Grade
27 questions
ROBOTICS
Presentation
•
6th - 12th Grade
26 questions
Circuits and Symbols
Presentation
•
9th - 12th Grade
26 questions
AVOIR/ETRE/FAIRE/ALLER review
Presentation
•
7th - 12th Grade
27 questions
Module 3, Lesson 1.1
Presentation
•
7th - 12th Grade
26 questions
La Negation
Presentation
•
6th - 12th Grade
27 questions
Cell Structure and Function
Presentation
•
8th - 12th Grade
Popular Resources on Wayground
10 questions
How much do you know about our Portrait of an Eagle?
Quiz
•
10th Grade
10 questions
Fast Food Slogans
Quiz
•
6th - 8th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
12 questions
Map Skills
Quiz
•
3rd Grade
22 questions
Continents and Oceans
Quiz
•
5th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials
Interactive video
•
6th - 10th Grade
20 questions
Copyright and Fair Use
Quiz
•
6th - 8th Grade
20 questions
[AP CSP] Python Coding: Functions, Parameters, Return
Presentation
•
9th - 12th Grade
15 questions
Internet Safety
Quiz
•
7th Grade
40 questions
Introduction to Microsoft Word
Quiz
•
8th - 12th Grade
20 questions
APCS Unit 1A
Quiz
•
9th - 12th Grade
24 questions
Binary
Quiz
•
9th - 12th Grade