#import machine
from machine import Pin, SoftI2C    # la classe SoftI2C permet treballar amb l'I2C
from lcd_api import LcdApi
from i2c_lcd import I2cLcd
from time import sleep

i2c = SoftI2C (scl=Pin(22), sda=Pin(21), freq=10000)     #inicialitza l'I2C
lcd = I2cLcd (i2c, 0x27, 2, 16)    # inicialitza la LCD: associa a i2c, adreça I2C, núm de files, núm de columnes

monigote = bytearray ([0x0E, 0x0A, 0x0E, 0x04, 0x1F, 0x04, 0x0A, 0x11])
cor = bytearray([0x00, 0x00, 0x1B, 0x1F, 0x1F, 0x0E, 0x04, 0x00])

lcd.custom_char (0, monigote)
lcd.custom_char (1, cor)

lcd.move_to (3,0)
lcd.putstr(chr(0)+" ESP32 "+chr(1))