from machine import Pin
from machine import SoftI2C
import ssd1306
import time
# Configurar SoftI2C (SDA en GPIO21, SCL en GPIO22)
i2c = SoftI2C(scl=Pin(22), sda=Pin(21))
# Inicializar la pantalla OLED (128x64)
oled = ssd1306.SSD1306_I2C(128, 64, i2c)
# Limpiar la pantalla antes de comenzar
oled.fill(0)
# Mostrar texto en la pantalla OLED
oled.text("Hola, MicroPython!", 0, 0) # (texto, x, y)
# Actualizar la pantalla para reflejar los cambios
oled.show()
# Esperar unos segundos
time.sleep(5)
# Limpiar la pantalla nuevamente
oled.fill(0)
oled.show()