from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
import framebuf
import time
# Configuración del bus I2C
i2c = I2C(0, scl=Pin(1), sda=Pin(0), freq=200000) # SCL en GP1, SDA en GP0, frecuencia ajustada
# Escanear dispositivos I2C para verificar la dirección de la pantalla
print("Escaneando bus I2C...")
devices = i2c.scan()
if devices:
print("Dispositivos encontrados en direcciones:", [hex(device) for device in devices])
else:
print("¡No se encontraron dispositivos I2C! Revisa las conexiones.")
# Inicializar la pantalla OLED
WIDTH = 128
HEIGHT = 64
oled = SSD1306_I2C(WIDTH, HEIGHT, i2c)
# Logo "VINK€$" como bytearray (mantengo tu bytearray original)
logo = bytearray([
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 8, 88, 0, 8, 64, 16, 16, 65, 4, 0, 0, 0, 0, 0,
2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 64, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 12, 81, 70, 24, 32, 0, 0, 0, 0, 20,
0, 128, 0, 0, 0, 0, 12, 113, 196, 24, 0, 0, 0, 0, 4, 0,
0, 0, 64, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 250, 118, 189, 219, 192, 0, 0, 0, 0, 0,
0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 160, 0, 0, 0, 0, 0,
0, 0, 0, 0, 7, 243, 0, 0, 0, 0, 111, 224, 0, 0, 0, 0,
32, 0, 0, 0, 2, 211, 0, 0, 0, 0, 109, 160, 0, 0, 16, 0,
0, 24, 0, 0, 8, 3, 0, 0, 128, 0, 64, 0, 0, 0, 0, 0,
0, 0, 0, 0, 3, 179, 0, 0, 0, 0, 107, 224, 64, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64,
0, 3, 192, 240, 255, 225, 192, 120, 48, 14, 31, 239, 192, 255, 128, 0,
0, 1, 192, 240, 120, 225, 240, 112, 16, 58, 23, 252, 195, 229, 32, 0,
0, 3, 192, 240, 14, 1, 240, 56, 112, 252, 30, 0, 7, 128, 240, 16,
0, 3, 192, 112, 14, 1, 116, 120, 50, 240, 30, 0, 67, 128, 0, 0,
4, 3, 192, 240, 14, 1, 207, 120, 127, 128, 23, 254, 7, 255, 128, 0,
0, 1, 192, 176, 14, 33, 195, 120, 63, 128, 31, 252, 1, 255, 224, 8,
0, 3, 128, 240, 14, 1, 64, 184, 115, 192, 22, 0, 0, 0, 240, 0,
0, 1, 227, 226, 14, 1, 192, 120, 112, 248, 30, 8, 7, 16, 240, 0,
16, 0, 152, 64, 14, 1, 64, 48, 80, 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, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 2, 0, 4, 0, 0,
0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0
])
# Crear buffer de imagen
fb = framebuf.FrameBuffer(logo, 128, 64, framebuf.MONO_HLSB)
# Mostrar el logo
oled.fill(0)
oled.blit(fb, 0, 0)
oled.show()
time.sleep(3)
# Limpiar y mostrar mensaje
oled.fill(0)
oled.text("Sistema listo", 15, 30)
oled.show()
# Bucle infinito para mantener el mensaje (similar al código de referencia)
while True:
time.sleep(1) # Evita que el programa termineLoading
pi-pico-w
pi-pico-w