from machine import Pin, PWM, ADC
from time import sleep
pwm0 = PWM(Pin(21))
adc = ADC(Pin(34))
#pot_value = adc-read()
#adc.atten(ADC_ATTN_11DB)
for i in range(0, 1023):
pot_value = adc.read()
pwm0_value = int(pot_value*(1023/4095))
volts = (pot_value*3.3)/4095
message = "pot:{pot}; pwm:{pwm}; volts:{voltage:0.2f}"
print(message.format(pot = pot_value, pwm = pwm0_value, voltage = volts))
# print("pot:", pot_value, "pwm:", pwm0_value, "volts:{:0.2f}", volts)
pwm0.duty(pwm0_value)
sleep(0.1)