from machine import Pin
import time

# Define the pins for the LEDs and the button
ledPin = Pin(26, Pin.OUT)      # Pin number for the first LED
ledPin1 = Pin(0, Pin.OUT)     # Pin number for the second LED
ledPin2 = Pin(1, Pin.OUT)     # Pin number for the third LED
buttonPin = Pin(27, Pin.IN, Pin.PULL_DOWN)  # Pin number for the button

while True:
    # Read the state of the button
    buttonState = buttonPin.value()
    
    if buttonState:  # If the button is pressed
        for i in range(5):  # Repeat the following block 5 times
            time.sleep(1)  # Wait for 1 second
            ledPin.on()  # Turn on the first LED
            time.sleep(1)  # Wait for 1 second
            ledPin1.on()  # Turn on the second LED
            time.sleep(1)  # Wait for 1 second
            ledPin2.on()  # Turn on the third LED
            time.sleep(1)  # Wait for 1 second
            ledPin.off()  # Turn off the first LED
            time.sleep(1)  # Wait for 1 second
            ledPin1.off()  # Turn off the second LED
            time.sleep(1)  # Wait for 1 second
            ledPin2.off()  # Turn off the third LED
    else:  # If the button is not pressed
        ledPin.off()  # Turn off the first LED
        ledPin1.off()  # Turn off the second LED
        ledPin2.off()  # Turn off the third LED
