from machine import Pin, I2C
import ssd1306
# Set up the I2C interface using pins 9 (SCL) and 8 (SDA) on the Raspberry Pi Pico
i2c = I2C(0, scl=Pin(9), sda=Pin(8))
# Define the screen dimensions
WIDTH = 128
HEIGHT = 32
LINE_HEIGHT = HEIGHT // 3 # Divide screen vertically into 3 lines
"""
Note the display in your kit has 128 x 32 pixels, the display in wokwi is taller.
"""
# Create the OLED display object
oled = ssd1306.SSD1306_I2C(WIDTH, HEIGHT, i2c)
# Clear the screen (fill with black)
oled.fill(0)
# Write three lines of text to the screen
oled.text("SSD1306 - YES", 0, 0) # First line, at top
oled.text("Hello", 0, LINE_HEIGHT + 1) # Second line
oled.text("World", 10, 2 * LINE_HEIGHT + 1) # Third line, slightly indented
# Update the display to show the new content
oled.show()