from machine import Pin, I2C
import ssd1306
import time
# Configuración I2C
i2c = I2C(
scl=Pin(22),
sda=Pin(21),
freq=400000
)
# Crear objeto OLED
oled = ssd1306.SSD1306_I2C(128, 64, i2c)
# Limpiar pantalla
oled.fill(0)
# Mostrar texto
oled.text("ESP32 + OLED", 0, 0)
oled.text("MicroPython", 0, 16)
oled.text("Wokwi OK!", 0, 32)
# Actualizar pantalla
oled.show()
# Bucle infinito
while True:
time.sleep(1)