from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
from time import sleep
# Define the I2C pins (you can adjust these pins based on your wiring)
i2c = I2C(scl=Pin(22), sda=Pin(21), freq=400000) # Use your own pin numbers
# You may need to adjust the frequency (freq) based on your display's specifications.
# Initialize the OLED display with its dimensions (128x64) and the I2C object
oled = SSD1306_I2C(128, 64, i2c)
# Clear the display
oled.fill(0)
# Set the text position and font size
oled.text("esp MicroPython!", 10, 0)
oled.text("This is a test.", 10, 20)
oled.text("by arvind india!", 10, 40)
oled.text("gate 20 sept 23.", 10, 55)
# Update the display to show the text
oled.show()
# Delay to allow time to see the text (optional)
sleep(5)
# Turn off the OLED display
oled.poweroff()