import time
from machine import I2C, SoftI2C, Pin, PWM, ADC
from pico_i2c_lcd import I2cLcd
time.sleep(0.1) # Wait for USB to become ready
i2c = SoftI2C(sda=Pin(2), scl=Pin(3), freq=40000)
addr=i2c.scan()[0]
lcd = I2cLcd(i2c, addr, 2, 16)
lcd.clear()
lcd.move_to(0,0)
load = PWM(Pin(0))
load.freq(1000)
adc=ADC(1)
while True:
load.duty_u16(adc.read_u16());
lcd.putstr(str(adc.read_u16()));
time.sleep(1)
lcd.clear()