from machine import Pin, I2C
import ssd1306
import utime
I2C_SCL=22# reloj
I2C_SDA=21# datos
i2c= I2C(0, scl=Pin(I2C_SCL),sda=Pin(I2C_SDA), freq=400000)
#freq esta dada en Hz, son 400KHz
oled = ssd1306.SSD1306_I2C(128, 64, i2c)
def limpiar_pantalla():
oled.fill(0)#llenar la pantalla de nada
oled.show()#aplicar los cambios
def mostrar_texto(texto, x=0, y=0):
oled.text(texto, x, y)
oled.show()
contador=0
while True:
limpiar_pantalla()
mostrar_texto("Hola mundo!", 24, 0 )
mostrar_texto("11-1!", 42, 16 )
mostrar_texto(str(contador),24,32)
utime.sleep(2)
limpiar_pantalla()
contador+=1
# https://wokwi.com/projects/439728093207398401