Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the SSD1306 library.
Raspberry Pi
from adafruit_ssd1306 import [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing SPI or UART classes which are for different communication protocols.
✗ Incorrect
The SSD1306_I2C class is used to control the OLED display over I2C.
2fill in blank
mediumComplete the code to initialize the I2C bus on Raspberry Pi.
Raspberry Pi
import board import busio i2c = busio.[1](board.SCL, board.SDA)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using SPI or UART which are different communication protocols.
✗ Incorrect
busio.I2C initializes the I2C bus using the SCL and SDA pins.
3fill in blank
hardFix the error in the code to create the display object with correct width and height.
Raspberry Pi
display = SSD1306_I2C([1], 64, i2c)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 64 as width which is actually the height.
✗ Incorrect
The common OLED display size is 128x64 pixels, so width should be 128.
4fill in blank
hardFill both blanks to clear the display and show the changes.
Raspberry Pi
display.[1](0) display.[2]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using clear() which is not a method in this library.
Calling update() instead of show() which is the correct method.
✗ Incorrect
Calling fill(0) clears the display buffer, and show() updates the screen.
5fill in blank
hardFill all three blanks to draw text on the display and update it.
Raspberry Pi
display.text([1], 0, [2], 1) display.[3]()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 20 for y which might place text too low or off screen.
Forgetting to call show() to update the display.
✗ Incorrect
text() draws the string at x=0, y=10 with color 1, then show() updates the display.
