import machine
import time
# Define the analog pin where the potentiometer is connected (e.g., GPIO 34)
potentiometer_pin = machine.ADC(machine.Pin(34))
lednum = [
2,4,16,17,5
]
while True:
# Read the analog value (0-4095)
pot_value = potentiometer_pin.read()
mapped_value = int((pot_value / 4095) * 4)
print(mapped_value,'--')
print(lednum[mapped_value])
binrun = machine.Pin(lednum[mapped_value], machine.Pin.OUT)
binrun.on()
time.sleep(0.1) # Add a small delay to prevent excessive readings
binrun.off()