# Importar librerias
import time
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
import framebuf
WIDTH =128
HEIGHT= 64
# Canal
i2c=I2C(0,scl=Pin(5),sda=Pin(4),freq=2000000)
oled = SSD1306_I2C(WIDTH,HEIGHT,i2c)
# Matriz en bytearray: dibujo de un quirquincho sencillo (48x48 píxeles)
agumon = bytearray([
0xf8, 0x1f, 0xf7, 0xef, 0x8f, 0x37, 0x7f, 0x97,
0x7f, 0x17, 0x79, 0xf7, 0x87, 0xf7, 0xbf, 0x2f,
0xc0, 0xef, 0xe7, 0x37, 0xd6, 0xe7, 0xc6, 0x38,
0xf3, 0xa2, 0xcc, 0x39, 0xad, 0x55, 0x81, 0x01
])
# Crear framebuffer
fb = framebuf.FrameBuffer(agumon, 16, 16, framebuf.MONO_HLSB)
def main():
while True:
print("Graficando un BMP")
oled.fill(0)
oled.blit(fb, 8, 22)
oled.show()
time.sleep(2)
#oled.fill(0)
print("Mensaje")
oled.text("Calculadora", 28, 0)
oled.text("cientifica", 30,10)
oled.text("Pi Pico W", 32, 20)
oled.text("SSD1306",40, 30)
oled.text("Edwin Luis", 30, 45)
oled.text("Garavito Omoya", 13, 55)
oled.show()
time.sleep(4)
oled.fill(0)
if __name__== '__main__':
main()