Bird
0
0
Arduinoprogramming~10 mins

16x2 LCD with LiquidCrystal library in Arduino - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize the LCD with 16 columns and 2 rows.

Arduino
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  lcd.[1](16, 2);
}

void loop() {
  // Your code here
}
Drag options to blanks, or click blank then click option'
Astart
Bbegin
Cinit
Dsetup
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' or 'init' instead of 'begin'.
Trying to set size outside the setup function.
2fill in blank
medium

Complete the code to print the text "Hello, World!" on the LCD.

Arduino
void loop() {
  lcd.[1]("Hello, World!");
}
Drag options to blanks, or click blank then click option'
Aprint
Bwrite
Cdisplay
Dshow
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'write' which prints a single character or byte.
Using non-existent methods like 'display' or 'show'.
3fill in blank
hard

Fix the error in the code to set the cursor to the first column and second row.

Arduino
void loop() {
  lcd.setCursor([1], 1);
  lcd.print("Line 2");
}
Drag options to blanks, or click blank then click option'
A1
B-1
C2
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 for the first column which is actually the second column.
Using negative numbers which are invalid.
4fill in blank
hard

Fill both blanks to clear the LCD and then print "Ready" at the beginning.

Arduino
void loop() {
  lcd.[1]();
  lcd.setCursor([2], 0);
  lcd.print("Ready");
}
Drag options to blanks, or click blank then click option'
Aclear
B1
C0
Dhome
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'home' instead of 'clear' to erase the screen.
Setting cursor to column 1 instead of 0.
5fill in blank
hard

Fill all three blanks to create a scrolling message that moves left on the LCD.

Arduino
void loop() {
  lcd.clear();
  lcd.setCursor([1], 0);
  lcd.print("Scrolling");
  lcd.[2]();
  delay([3]);
}
Drag options to blanks, or click blank then click option'
A15
BscrollDisplayLeft
C300
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Starting cursor at column 15 which is off screen for the message.
Using delay too short or too long for smooth scrolling.