import time
from machine import Pin, I2C, SoftI2C, ADC, PWM
from pico_i2c_lcd import I2cLcd
led = PWM(Pin(0))
led.freq(1000)
adc = ADC(28)
i2c = SoftI2C(sda=Pin(14), scl=Pin(15), freq=400000)
lcd_address = i2c.scan()[0]
lcd = I2cLcd(i2c, lcd_address, 2, 16)
while True:
value = adc.read_u16()
lcd.move_to(0,0)
lcd.putstr("Duty Cycle:-")
lcd.move_to(0,1)
lcd.putstr(f"{value}")
led.duty_u16(value)
time.sleep(0.6)