What does the lcd.setCursor(col, row) function do in Arduino LCD programming?
It moves the cursor to the specified column (col) and row (row) on the LCD screen, so the next characters will be printed starting from that position.
Click to reveal answer
beginner
How are the column and row numbers indexed in lcd.setCursor(col, row)?
Both column and row numbers start at 0. So, lcd.setCursor(0, 0) moves the cursor to the top-left corner of the LCD.
Click to reveal answer
beginner
Why is it important to set the cursor position before printing text on an LCD?
Because the LCD prints characters starting from the current cursor position. If you don't set it, text might appear in unexpected places or overwrite existing text.
Click to reveal answer
intermediate
What happens if you set the cursor position outside the LCD's size using lcd.setCursor()?
The behavior is undefined; usually, the LCD will ignore the command or wrap around, causing text to appear in wrong places or not at all.
Click to reveal answer
beginner
How do you clear the LCD screen and reset the cursor to the home position?
Use lcd.clear() to clear the screen and reset the cursor to (0, 0).
Click to reveal answer
What does lcd.setCursor(5, 1) do?
AMoves the cursor to column 1, row 5
BMoves the cursor to column 5, row 1
CClears the LCD screen
DPrints text at the current cursor position
✗ Incorrect
The first number is the column, the second is the row. So it moves the cursor to column 5, row 1.
If you want to print text at the top-left corner of the LCD, which command should you use?
Alcd.setCursor(0, 0)
Blcd.setCursor(1, 1)
Clcd.clear()
Dlcd.print(0, 0)
✗ Incorrect
Columns and rows start at 0, so (0, 0) is the top-left corner.
What happens if you print text without setting the cursor position first?
AText prints at the current cursor position
BText prints at the bottom-right corner
CLCD clears automatically
DProgram crashes
✗ Incorrect
The LCD prints text starting from wherever the cursor currently is.
Which function clears the LCD screen and resets the cursor?
Alcd.home()
Blcd.reset()
Clcd.clear()
Dlcd.setCursor(0,0)
✗ Incorrect
lcd.clear() clears the screen and resets the cursor to (0,0).
What is the correct way to move the cursor to the second row, third column?
Alcd.setCursor(3, 2)
Blcd.setCursor(1, 2)
Clcd.setCursor(1, 3)
Dlcd.setCursor(2, 1)
✗ Incorrect
Columns and rows start at 0, so third column is 2 and second row is 1.
Explain how to position the cursor on an Arduino LCD before printing text.
Think about how you tell the LCD where to start writing.
You got /3 concepts.
Describe what happens if you try to set the cursor outside the LCD's visible area.
Consider what happens if you point somewhere the LCD can't show.
You got /3 concepts.
Practice
(1/5)
1. What does the Arduino command lcd.setCursor(0, 1) do on a 16x2 LCD?
easy
A. Clears the LCD screen
B. Moves the cursor to the second column of the first row
C. Moves the cursor to the first column of the second row
D. Prints text at the current cursor position
Solution
Step 1: Understand lcd.setCursor parameters
The first number is the column (starting at 0), the second is the row (starting at 0).
Step 2: Apply to given command
lcd.setCursor(0, 1) moves the cursor to column 0 (first column) and row 1 (second row).
Final Answer:
Moves the cursor to the first column of the second row -> Option C
Quick Check:
Columns and rows start at zero = first column, second row [OK]
Hint: Remember columns and rows start at zero [OK]
Common Mistakes:
Thinking rows start at 1 instead of 0
Confusing column and row order
Assuming setCursor prints text
2. Which of the following is the correct syntax to set the cursor to the third column and first row on an LCD?
easy
A. lcd.setCursor(3, 1);
B. lcd.setCursor(1, 2);
C. lcd.setCursor(0, 3);
D. lcd.setCursor(2, 0);
Solution
Step 1: Recall zero-based indexing
Columns and rows start at 0, so third column is 2, first row is 0.
Step 2: Match parameters to correct syntax
lcd.setCursor(2, 0) sets cursor to third column, first row.
Final Answer:
lcd.setCursor(2, 0); -> Option D
Quick Check:
Third column = 2, first row = 0 [OK]
Hint: Count columns and rows from zero [OK]
Common Mistakes:
Using 1-based indexing for columns or rows
Swapping column and row values
Missing semicolon at end
3. What will be the output on a 16x2 LCD after running this code?
A. First row: 'Hi' starting at first column, second row: 'Bye' starting at first column
B. First row: ' Hi' (5 spaces then Hi), second row: 'Bye' starting at first column
C. First row: 'Hi' starting at sixth column, second row: 'Bye' starting at sixth column
D. First row: ' Hi' (5 spaces then Hi), second row: ' Bye' (5 spaces then Bye)
Solution
Step 1: Analyze first setCursor and print
lcd.setCursor(5, 0) moves cursor to column 5, row 0. Printing "Hi" starts at column 5 on first row.
Step 2: Analyze second setCursor and print
lcd.setCursor(0, 1) moves cursor to first column, second row. Printing "Bye" starts there.
Final Answer:
First row: ' Hi' (5 spaces then Hi), second row: 'Bye' starting at first column -> Option B
Quick Check:
Cursor moves control print position [OK]
Hint: Cursor sets exact print start position [OK]
Common Mistakes:
Assuming print always starts at first column
Confusing row and column numbers
Ignoring spaces before printed text
4. Identify the error in this Arduino code snippet for LCD cursor positioning:
lcd.setCursor(16, 0);
lcd.print("Hello");
medium
A. Column index 16 is out of range for a 16-column LCD
B. Row index 0 is invalid, should start at 1
C. Missing lcd.begin() before setCursor
D. lcd.print() cannot print strings
Solution
Step 1: Check column index range
Columns start at 0, so valid columns are 0 to 15 for a 16-column LCD. 16 is out of range.
Step 2: Verify other parts
Row 0 is valid (rows start at 0). lcd.print() can print strings. lcd.begin() is needed but not shown here, but question focuses on cursor.
Final Answer:
Column index 16 is out of range for a 16-column LCD -> Option A
Quick Check:
Column max index = 15 for 16 columns [OK]
Hint: Columns max at size minus one [OK]
Common Mistakes:
Using 1-based indexing for columns
Assuming lcd.print can't print strings
Ignoring lcd.begin() requirement
5. You want to display a 4-letter word centered on the second row of a 20x4 LCD. Which lcd.setCursor() command correctly positions the cursor before printing?
hard
A. lcd.setCursor(8, 1);
B. lcd.setCursor(9, 1);
C. lcd.setCursor(7, 1);
D. lcd.setCursor(10, 1);
Solution
Step 1: Calculate center position for 4 letters on 20 columns
Center column is 20 / 2 = 10. For 4 letters, start at 10 - (4 / 2) = 8.
Step 2: Set cursor to column 8 on second row
Row 1 is second row (rows start at 0). So lcd.setCursor(8, 1) is correct.
Final Answer:
lcd.setCursor(8, 1); -> Option A
Quick Check:
Center start = half width minus half word length [OK]
Hint: Center = (width/2) - (word length/2) [OK]
Common Mistakes:
Using 1-based indexing for rows or columns
Starting cursor too far left or right
Confusing row and column numbers
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.