import random, time
from machine import Pin
led = Pin(27, Pin.OUT)
button = Pin(35, Pin.IN)
check = False
while True:
if not check:
delay = random.randrange(2000,5000)
for i in range(10):
fill_count = i
print("[" + "#"*fill_count + " "*(10-fill_count) + "]")
time.sleep_ms(delay//10)
led.value(1)
print("start")
start = time.ticks_ms()
check = True
if check:
button_value = button.value()
print(button_value)
if button_value == 1:
led.value(0)
end = time.ticks_ms()
print("finished")
print(end - start)
break