#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))
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
lcd1:GND
lcd1:VCC
lcd1:SDA
lcd1:SCL