import machine
from pico_i2c_lcd import I2cLcd
sdaPIN=machine.Pin(21) #for ESP32
sclPIN=machine.Pin(22)
i2c=machine.I2C(sda=sdaPIN, scl=sclPIN, freq=10000)
devices = i2c.scan()
if len(devices) == 0:
print("No i2c device !")
else:
print('i2c devices found:',len(devices))
for device in devices:
print("At address: ",hex(device))
lcd = I2cLcd(i2c, devices[0], 2, 16)
while True:
lcd.move_to(0,0)
lcd.putstr("I2CAddress:"+hex(devices[0])+"\n")
lcd.move_to(0,1)
lcd.putstr("CircuitSchools.")