Challenge - 5 Problems
Display Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What does this Arduino code display on the LCD?
Given the following Arduino code snippet using a 16x2 LCD, what will be shown on the display after running?
Arduino
#include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { lcd.begin(16, 2); lcd.print("Hello, World!"); lcd.setCursor(0, 1); lcd.print("Count: "); lcd.print(5); } void loop() {}
Attempts:
2 left
💡 Hint
Look at the lcd.setCursor position and what is printed on each line.
✗ Incorrect
The lcd.print("Hello, World!") prints on the first line. Then lcd.setCursor(0, 1) moves cursor to start of second line where "Count: " and then 5 are printed.
🧠 Conceptual
intermediate1:30remaining
Why do displays enhance Arduino projects?
Which of the following is the best reason why adding a display enhances an Arduino project?
Attempts:
2 left
💡 Hint
Think about how users interact with projects and what displays provide.
✗ Incorrect
Displays let the project show messages, sensor readings, or status directly to the user, making it easier to understand and use without extra devices.
🔧 Debug
advanced2:30remaining
Why does this OLED display code show a blank screen?
This Arduino code is supposed to show "Temp: 25C" on an OLED display but the screen stays blank. What is the cause?
Arduino
#include <Wire.h> #include <Adafruit_SSD1306.h> #define SCREEN_WIDTH 128 #define SCREEN_HEIGHT 64 Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire); void setup() { display.begin(SSD1306_SWITCHCAPVCC, 0x3C); display.clearDisplay(); display.setTextSize(2); display.setTextColor(SSD1306_WHITE); display.setCursor(0,0); display.print("Temp: 25C"); } void loop() {}
Attempts:
2 left
💡 Hint
After drawing text, what function must be called to show it on the OLED?
✗ Incorrect
The Adafruit_SSD1306 library requires calling display.display() after drawing commands to send the buffer to the screen. Without it, the screen stays blank.
📝 Syntax
advanced2:00remaining
Which option fixes the syntax error in this Arduino sketch?
This code tries to print sensor values on an LCD but has a syntax error. Which option fixes it?
Arduino
#include <LiquidCrystal.h> LiquidCrystal lcd(7, 8, 9, 10, 11, 12); void setup() { lcd.begin(16, 2); } void loop() { int sensorValue = analogRead(A0) lcd.clear(); lcd.print("Value: " + sensorValue); delay(1000); }
Attempts:
2 left
💡 Hint
Check for missing semicolons and how to print text plus numbers on LCD.
✗ Incorrect
The missing semicolon after analogRead(A0) causes a syntax error. Also, lcd.print does not support adding strings and integers directly with +, so print text and number separately.
🚀 Application
expert1:00remaining
How many characters can a 16x2 LCD display at once?
You have a 16x2 character LCD connected to your Arduino. How many total characters can it show on screen at the same time?
Attempts:
2 left
💡 Hint
Multiply the number of columns by the number of rows.
✗ Incorrect
A 16x2 LCD has 16 columns and 2 rows, so it can show 16 * 2 = 32 characters at once.
