from machine import Pin
from utime import sleep
# Define pins for the LEDs
led_pins = [Pin(9, Pin.OUT), Pin(12, Pin.OUT), Pin(2, Pin.OUT), Pin(28, Pin.OUT), Pin(5, Pin.OUT),Pin(20, Pin.OUT)]
# Turn off all LEDs initially
for led in led_pins:
led.off()
while True:
for led in led_pins:
led.on() # Turn on the current LED
sleep(0.5) # Wait for half a second
led.off() # Turn off the current LED before moving to the next one
# Reverse order: LEDs on in reverse sequence
for led in reversed(led_pins):
led.on()
sleep(0.5)
led.off()