Font size
WorksheetsArduino Homework Week 9
Total questions: 24
Worksheet time: 19mins
Which library is required to use an LCD with Arduino?
#include <lcd.h>
#include <liquidcrystal.h>
#include <display.h>
#include <arduinolcd.h>
What does lcd.begin(16, 2); do?
Connects the LCD to Arduino
Clears the LCD screen
Starts the LCD backlight
Initializes an LCD with 16 columns and 2 rows
What will the following code do?
Display 'Hello, world!' and then clear the screen
Continuously print 'Hello, world!' on the screen
Display 'Hello, world!' once and keep it on the screen
Display 'Hello, world!' but only for 1 second
What will happen when this code runs?
Prints 'LCD' but then clears the screen
Prints 'LCD' at the 5th column of the second row
Prints 'LCD' at the 5th column of the first row
Causes an error because setCursor() is incorrect
What does this snippet do?
Clears the LCD screen
Makes the LCD text blink on and off
Turns off the LCD backlight
Moves the text left
What is the correct way to clear the LCD screen?
lcd.delete();
lcd.clear();
lcd.reset();
lcd.wipe();
What will this loop do?
Move the text 5 positions to the right
Print the number 5 on the LCD
Move the text 5 positions to the left
Cause an error
What will be displayed after running this code?
"Hi" at the start of the first row
"Hi" at column 10 of the first row
"Hi" at the start of the second row
"Hi" at column 10 of the second row
Which of the following correctly uses the ELSE IF statement?
Use the code block below to create an IF statement that will do the following:
1 - Check to see if the value from a potentiometer is greater than 0 and less then or equal to 150. 2 - Run a program called RED if true.
(a) (b) (c) (d)
RED();
What does "clear()" do?
It clears the script from the Arduino
It clears the LCD screen of any characters
It clears the power and ground connections to the LCD screen
It clears the resistance on the LCD screen
What does "setCursor()" do?
It powers on the backlight of the LCD screen
It clears the LCD screen of all characters
It sets the position of the potentiometer on the LCD screen
It sets the position of the cursor on the LCD screen
What are the 2 numbers in "setCursor()" for?
1st: column number, 2nd: row number
1st: row number, 2nd: column number
1st: row number, 2nd: row number
1st: Power, 2nd: Ground
This part is called a
Piezo buzzer
Push button
Potentiometer
None of the Above
Which of these is a correct way to check if a variable temp is below 0°C OR above 100°C?
What will the following Arduino code print if x = 3?
Match Found
No Match
Error: OR condition used incorrectly
It won’t print anything
Modify the following Arduino code to turn on an LED if either button is pressed (button1 == HIGH OR button2 == HIGH).
(a)
{ digitalWrite(ledPin, HIGH); }
Match what the code will run if the sensorValue is:
300
Low
450
Normal
550
Normal
700
High
We want to modify the program and insert a new else if command after 'mild' but before 'cold'.
The new code should checks that the temperature is greater than or equal to 5.
If true it should respond with 'Freezing'
Select the correct code
How many times will the shown for loop execute?
0
9
10
11
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
What will this code print out?
Type in the sequence with only spaces in between the numbers.
(a)
Create a for loop that counts down from 10 while the number is equal to or greater than 5, decreasing with 1 for each loop.
for (int (a) ; (b) ; (c) )
