from machine import Pin, PWM, ADC
# Creating variables
pwm = PWM(Pin(15)) # Creating the PWM.
pwm.freq(1000) # Setting the frequency of the PWM.
potmeter = ADC(Pin(28)) # Linking the Potentiometer to the Pico
# Main code
while True:
volt = potmeter.read_u16() # Reads the potentiometer value based on dial in 16-bit
#print(volt)
pwm.duty_u16(volt) # the potentiometer value changes duty cycle thus changing brightness