#write a micropython script to control red led wrt the position of the switch, and the control the blue led wrt to the position of a pot
from machine import Pin,PWM,ADC
from time import sleep
f=20000 #0 to 78125
l=Pin(2,mode=Pin.OUT)
l2=PWM(Pin(5,mode=Pin.OUT),f)
b=Pin(15,mode=Pin.IN)
pot=ADC(Pin(34,mode=Pin.IN))
pot.width(ADC.WIDTH_10BIT) #9-511 10-1023 11-2047 12-4095(default)
pot.atten(ADC.ATTN_11DB) #11 --> 3.3V 5 --> 2V 2 -->V 1.5 --> 3.3V(maximum voltage provided to the analog pin used such that 0=0v and x=yV)
while True:
val2 = pot.read();
l2.duty(val2);
val = b.value();
l.value(val);