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 = 5
i = 1
def table(t):
global num, i
lcd.clear()
result = f"{num} * {i} = {num*i}"
lcd.putstr(result)
i += 1
timer = Timer(freq=1, mode=Timer.PERIODIC, callback=table)