import time
from time import sleep
from machine import Pin
import random
led1=Pin(0,Pin.OUT)
led2=Pin(1,Pin.OUT)
led3=Pin(2,Pin.OUT)
led4=Pin(3,Pin.OUT)
led5=Pin(16,Pin.OUT)
led6=Pin(17,Pin.OUT)
led7=Pin(18,Pin.OUT)
led8=Pin(19,Pin.OUT)


while True:
    temp=random.randint(0,254)
    sleep(0.5)
    if temp%2>0:
        led8.on()
    else:
        led8.off()
    
    if temp%4>1:
        led7.on()
    else:
        led7.off()
    
    if temp%8>3:
        led6.on()
    else:
        led6.off()

    if temp%16>7:
        led5.on()
    else:
        led5.off()

    if temp%32>15:
        led4.on()
    else:
        led4.off()
    
    if temp%64>31:
        led3.on()
    else:
        led3.off()
    
    if temp%128>63:
        led2.on()
    else:
        led2.off()
    
    if temp%256>127:
        led1.on()
    else:
        led1.off()

    sleep(0.5)
    if temp==255:
        break
        



Loading
pi-pico-w