from machine import Pin, I2C
import ssd1306
from utime import sleep

# ESO32 Pin assingment
i2c = I2C(0, scl=Pin(22), sda=Pin(21))

olde_with = 128
olde_height = 64
olde = ssd1306.SSD1306_I2C(olde_with, olde_height, i2c)

led = Pin(14, Pin.OUT)
btn = Pin(35, Pin.IN)

olde.text('I. S. Automa.', 10, 20)
olde.show()
sleep(1)

olde.text('Elaborado por:', 10, 20)
olde.text
sleep(1)

olde.text('Giovanny', 10, 40)
olde.show()
sleep(1)

olde.fill(0)
olde.show()

while True:
    olde.text('Lectura Digital', 5, 10)
    olde.show()

    if btn() == 0:
        
        led.on()
        print('led encendido')

    else:
        led.off()
        print('led apagado')