##################################################
##  UPTV  13/03/2025
### Alejandro A Chirinos S
### C.I:26.634.695
### Seccion:431
##################################################
from machine import Pin, ADC
from time import sleep

# LEDs (0 a 7)
led_pins = [Pin(i, Pin.OUT) for i in range(8)]  # LEDs conectados a GP0-GP7

# Configuración del potenciómetro (GP26)
pot = ADC(Pin(26))
def int_to_bin_list(number):
    return [int(bit) for bit in f"{number:08b}"] 

while True:
    adc_value = pot.read_u16()
    number = int(adc_value / 256) 
    binary_bits = int_to_bin_list(number)
    for i in range(8):
        led_pins[i].value(binary_bits[i])
    
    # Pequeña pausa para evitar parpadeos
    sleep(0.1)
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT