from machine import Pin, I2C, Timer
from pico_i2c_lcd import I2cLcd
sda = Pin(0)
scl = Pin(1)
i2c = I2C(0, sda=sda, scl=scl, freq=40000)
devices = i2c.scan()
if len(devices) <= 0:
print("No devices found!")
else:
print(hex(devices[0]))
i2c_addr = devices[0]
lcd = I2cLcd(i2c, i2c_addr, 2, 16)
num = 0
def fn(timer):
global num
lcd.clear()
lcd.putstr(str(num))
num += 1
timer = Timer(freq=1, mode=Timer.PERIODIC, callback=fn)