from time import sleep, ticks_ms
from machine import I2C, Pin
from i2c_lcd import I2cLcd
i2c = I2C(0, sda=Pin(21), scl=Pin(22), freq=400000)
DEFAULT_I2C_ADDR = i2c.scan()[0]
lcd = I2cLcd(i2c, DEFAULT_I2C_ADDR, 2, 16)
while True:
print("I2C Addr: "+ str(DEFAULT_I2C_ADDR))
lcd.putstr("I2C Addr: "+str(DEFAULT_I2C_ADDR))
sleep(2)
lcd.clear()
print("I2C Addr:"+str(hex(DEFAULT_I2C_ADDR)))
lcd.putstr("I2C Addr: "+str(hex(DEFAULT_I2C_ADDR)))
sleep(2)
lcd.clear()