from machine import Pin
import utime

leds = [Pin(1, Pin.OUT), Pin(2, Pin.OUT), Pin(4, Pin.OUT), Pin(5, Pin.OUT)]

count = 0
start = utime.ticks_ms()

while True:
    utime.sleep(0.5)

    
    binary_count = bin(count)[2:]
    binary_count = '0' * (4 - len(binary_count)) + binary_count

    
    for i in range(4):
        if binary_count[3 - i] == '1':
            leds[i].on()
        else:
            leds[i].off()

    count = (count + 1) % 16  

    if count == 0:
        break

end = utime.ticks_ms()
print("time taken:", end - start, "ms")

BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT