from machine import Pin
import utime
import urandom
led=Pin(15,Pin.OUT)
button=Pin(14,Pin.IN)
def press(pin):
button.irq(handler=None)
reaction_time=utime.ticks_diff(utime.ticks_ms(),timer_light_off)
print('your reaction time was'+str(reaction_time)+'ms')
led.value(1)
utime.sleep(urandom.uniform(5,10))
led.value(0)
timer_light_off=utime.ticks_ms()
button.irq(trigger=machine.Pin.IRQ_RISING,handler=press)