Complete the code to import the library needed to control the OLED display.
import [1]
The adafruit_ssd1306 library is used to control the OLED display on Raspberry Pi.
Complete the code to initialize the I2C interface for the OLED display.
i2c = [1]()The OLED display uses the I2C communication protocol, so we initialize it with I2C().
Fix the error in the code to create the OLED display object with correct width and height.
display = adafruit_ssd1306.SSD1306_I2C([1], 64, i2c)
The OLED display used here has a width of 128 pixels and a height of 64 pixels. The first argument is the width, so it should be 128. The code has 64 as the second argument (height), so the first argument must be 128.
Fill both blanks to clear the display and then show the new content.
display.[1]() display.[2]()
To clear the display, we use fill(). To update the display with new content, we use show().
Fill both blanks to create a dictionary comprehension that stores sensor readings greater than 50.
filtered_readings = {sensor: value for sensor, value in readings.items() if value {BLANK_1}} {{BLANK_2}}
print(filtered_readings)The dictionary comprehension filters readings where the value is greater than 50. The print statement ends with a closing parenthesis ).
