from machine import Pin, PWM, ADC
from time import sleep
frequency = 5000
led = PWM(Pin(23), frequency)
adc = ADC(Pin(34))
adc.atten(ADC.ATTN_11DB)
while True:
value = int(adc.read()*0.25)
led.duty(value)
duty = (value*100)/1023
print("Value :" , value)
print("Duty Cycle:", int(duty))
sleep(0.02)