import time
from machine import Pin, I2C
import ssd1306
import framebuf

i2c = I2C(0, scl=Pin(25), sda=Pin(26))
oled = ssd1306.SSD1306_I2C(128, 64, i2c)

# logo_buffer = bytearray(b"\x00\x00\x03\xf0\x0f\xf8\x1c\xf4\x3c\xf2\x3f\xf2\x7f\xe1\x7f\xc1\x7f\x81\x7c\x01\x78\x01\x38\x62\x38\x62\x1c\x04\x0e\x18\x03\xe0")
logo_buffer = bytearray(b"\x3c\x7e\xed\xfd\xc1\xc9\x42\x3c")
fb = framebuf.FrameBuffer(logo_buffer, 8, 8, framebuf.MONO_HLSB)
oled.fill(0)
for i in range(3):
    x = 119-11*i
    oled.blit(fb, x, 1)
    oled.blit(fb, x, 55)

oled.show()

tCiclo = 200

deadline = time.ticks_ms()
while True:
    deadline = time.ticks_add(deadline, tCiclo)
    while time.ticks_diff(deadline, time.ticks_ms()) > 0:
        time.sleep_ms(1)