from machine import Pin
import time

led_pins = [13, 14, 15, 2, 4 , 17, 5, 18]
Leds = [Pin(led_pin, Pin.OUT) for led_pin in led_pins]

Leds_ON = 0

Car_enter = Pin(34, Pin.IN, Pin.PULL_UP)
Car_leave = Pin(35, Pin.IN, Pin.PULL_UP)

while True:
    Car_enter_state = Car_enter.value()
    if Car_enter_state == 0 and Leds_ON < 8:
        Leds[Leds_ON].value(1)
        Leds_ON += 1
        time.sleep(0.2)  

    Car_leave_state = Car_leave.value()
    if Car_leave_state == 0 and Leds_ON > 0:
        Leds_ON -= 1
        Leds[Leds_ON].value(0)
        time.sleep(0.2)
        print("Hello, ESP32!")