Bird
0
0
Arduinoprogramming~20 mins

Custom characters on LCD in Arduino - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
LCD Custom Character Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What does this Arduino LCD code output?

Consider this Arduino code snippet that creates a custom character and displays it on an LCD:

byte smiley[8] = {
  0b00000,
  0b01010,
  0b01010,
  0b00000,
  0b10001,
  0b01110,
  0b00000,
  0b00000
};

void setup() {
  lcd.begin(16, 2);
  lcd.createChar(0, smiley);
  lcd.setCursor(0, 0);
  lcd.write(byte(0));
}

void loop() {}

What will appear on the LCD screen?

Arduino
byte smiley[8] = {
  0b00000,
  0b01010,
  0b01010,
  0b00000,
  0b10001,
  0b01110,
  0b00000,
  0b00000
};

void setup() {
  lcd.begin(16, 2);
  lcd.createChar(0, smiley);
  lcd.setCursor(0, 0);
  lcd.write(byte(0));
}

void loop() {}
ACompilation error due to incorrect byte array size
BThe LCD shows a blank space at the first position
CThe LCD displays a random character at the first position
DA smiling face icon appears at the first position on the LCD
Attempts:
2 left
💡 Hint

Custom characters are stored in CGRAM and displayed by writing their index as a byte.

🧠 Conceptual
intermediate
1:00remaining
How many custom characters can an Arduino LCD typically store?

When using the LiquidCrystal library on a standard 16x2 LCD, how many custom characters can you create and store at the same time?

A8 custom characters
B16 custom characters
C4 custom characters
D32 custom characters
Attempts:
2 left
💡 Hint

Think about the CGRAM memory size in HD44780 compatible LCDs.

🔧 Debug
advanced
2:00remaining
Why does this custom character not display correctly?

Look at this Arduino code snippet:

byte heart[7] = {
  0b00000,
  0b01010,
  0b11111,
  0b11111,
  0b11111,
  0b01110,
  0b00100
};

void setup() {
  lcd.begin(16, 2);
  lcd.createChar(1, heart);
  lcd.setCursor(0, 0);
  lcd.write(byte(1));
}

void loop() {}

The heart shape does not appear as expected on the LCD. What is the most likely cause?

AThe LCD is not initialized with <code>lcd.begin</code>
BThe <code>lcd.write</code> function cannot print custom characters
CThe byte array has only 7 rows instead of 8, causing incorrect display
DThe <code>createChar</code> index 1 is invalid; it must be 0
Attempts:
2 left
💡 Hint

Custom characters require exactly 8 bytes for 8 rows.

📝 Syntax
advanced
1:30remaining
Which option correctly defines a custom character array for LCD?

Choose the correct syntax to define a custom character pattern for an Arduino LCD:

Abyte customChar[8] = {0b00000, 0b01010, 0b10101, 0b01010, 0b00000, 0b00000, 0b00000, 0b00000};
Bbyte customChar[8] = (0b00000, 0b01010, 0b10101, 0b01010, 0b00000, 0b00000, 0b00000, 0b00000);
Cbyte customChar[7] = {0b00000, 0b01010, 0b10101, 0b01010, 0b00000, 0b00000, 0b00000};
Dbyte customChar = {0b00000, 0b01010, 0b10101, 0b01010, 0b00000, 0b00000, 0b00000, 0b00000};
Attempts:
2 left
💡 Hint

Remember how to declare arrays in Arduino (C++).

🚀 Application
expert
2:30remaining
How to display multiple custom characters on LCD simultaneously?

You want to display two different custom characters side by side on a 16x2 LCD using Arduino. You have created two custom characters at indexes 0 and 1. Which code snippet correctly displays both characters on the first row?

Alcd.setCursor(0, 0); lcd.write(0); lcd.write(1);
Blcd.setCursor(0, 0); lcd.write(byte(0)); lcd.write(byte(1));
Clcd.setCursor(0, 0); lcd.print(byte(0)); lcd.print(byte(1));
Dlcd.setCursor(0, 0); lcd.print(0); lcd.print(1);
Attempts:
2 left
💡 Hint

Use write to print custom characters by their byte index.