from machine import SoftI2C, Pin
from i2c_lcd import I2cLcd
import time
i2c = SoftI2C(scl=Pin(22), sda=Pin(21), freq=400000)
#port=hex(i2c.scan()[0])#đã đổi sang mã dex
#lcd = I2cLcd(i2c, 0x3F, 4, 20)
#module thương 0x27 hoặc 0x3F
#dùng trên bỏ dưới
port=i2c.scan()[0]
lcd = I2cLcd(i2c, port, 4, 20)
lcd.clear()
lcd.move_to(3,0)#cột, hàng
lcd.putstr("Hello World!")
a=0
while True:
a+=1
lcd.move_to(0,2)#cột, hàng
lcd.putstr(str(a))
time.sleep_ms(1000)