Bird
0
0

Given this code snippet, what will the OLED display show?

medium📝 Predict Output Q5 of 15
Raspberry Pi - Display and Output
Given this code snippet, what will the OLED display show?
import Adafruit_SSD1306
from PIL import Image, ImageDraw

disp = Adafruit_SSD1306.SSD1306_128_64(rst=None)
disp.begin()
disp.clear()
disp.display()

image = Image.new('1', (disp.width, disp.height))
draw = ImageDraw.Draw(image)
draw.text((10, 20), 'Humidity: 60%', fill=255)
disp.image(image)
disp.display()
AHumidity: 60% shown at top-left corner
BNothing shown, display is blank
CHumidity: 60% shown shifted right and down
DError due to missing font
Step-by-Step Solution
Solution:
  1. Step 1: Check text position

    Text is drawn at coordinates (10, 20), which is right and down from top-left corner.
  2. Step 2: Confirm display update

    disp.image(image) and disp.display() update the OLED to show the drawn text.
  3. Final Answer:

    Humidity: 60% shown shifted right and down -> Option C
  4. Quick Check:

    Text position = (10, 20) means shifted display [OK]
Quick Trick: Coordinates control text position on OLED [OK]
Common Mistakes:
MISTAKES
  • Assuming text always starts at (0,0)
  • Expecting error without font specified (default font used)
  • Thinking display stays blank without disp.display()

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes