import time
import machine
from machine import Pin, I2C, SoftI2C, ADC, RTC, PWM
from pico_i2c_lcd import I2cLcd
i2c=SoftI2C(sda= Pin(26), scl= Pin(27), freq= 400000)
lcd_addr= i2c.scan()[0]
lcd= I2cLcd(i2c, lcd_addr, 2, 16)
lcd.clear()
lcd.move_to(0, 0)
adc= ADC(26)
led= PWM(Pin(0))
led.freq(1000)
led.duty_u16(65535)
x=0
while True:
vol= adc.read_u16()
x= vol/65535*100
print(x)
led.duty_u16(vol)
lcd.putstr(str(x)+"%")
time.sleep(1)
lcd.clear()