Gradual turning on LEDs
import board
import pwmio
import analogio
import time

# Create PWMOut objects for each LED
led = pwmio.PWMOut(board.GP26, frequency=5000)
led2 = pwmio.PWMOut(board.GP0, frequency=5000)
led3 = pwmio.PWMOut(board.GP1, frequency=5000)

# Assign pin A2 to potentiometer
potentiometer = analogio.AnalogIn(board.A2)

while True:
    # Read the analog value from the potentiometer and scale it
    brightness = potentiometer.value // 4  # Adjust scaling as needed

    # Adjust the sleep duration for a smoother transition
    time.sleep(0.05)

    # Set the duty cycle for each LED based on the scaled potentiometer value
    if 0 <= brightness <= 5461:
        led.duty_cycle = brightness
        led2.duty_cycle = 0
        led3.duty_cycle = 0
    elif 5461 < brightness <= 10922:
        led.duty_cycle = 65535
        led2.duty_cycle = brightness - 5461
        led3.duty_cycle = 0
    elif 10922 < brightness <= 16383:
        led.duty_cycle = 65535
        led2.duty_cycle = 65535
        led3.duty_cycle = brightness - 10922

    # Print the brightness value for debugging or monitoring
    print(brightness)