Flashlight with cone tracer

do you keep the button pressed for at least 1 sec so that the loop has time to run? the loop only run while the button is held.