# LED Brightness control using Potentiometer
from machine import ADC,Pin
from time import sleep
led_blue=Pin(12,Pin.OUT)
switch=Pin(27,Pin.IN)
led_red=Pin(14,Pin.OUT)
pot=ADC(Pin(15))
while True:
x=pot.read()
y=switch.value()
if(y==1):
led_red.value(1)
else:
led_red.value(0)
led_blue.value(1)
sleep(x/1000)
led_blue.value(0)
sleep(x/1000)