from machine import Pin
from time import sleep
led_pins = range(10, -1, -1) #line 4 to 23 is making the progress go higher for everytime the button is pressed and resests
button = Pin(16, Pin.IN)
count = 1
while True:
if button.value() == 1:
if count <=10:
pin_number = 10 - count
led = Pin(pin_number, Pin.OUT)
led.value(1)
count += 1
else:
for pin in led_pins:
led = Pin(pin, Pin.OUT)
led.value(0)
count = 1
sleep(0.3)