I am trying to make a lasergamegun and got stuck on this part of code. It has to light up an irLed and a yellowLed(in the code as flashLed) for a amount of time(1000 miliseconds is just for testing), I am using millis() because in the meanwhile it has to check if it has been hit. When I press the button the leds turn on but turn of when the millis-clock has reached a number in the table of 1000, but I need to turn it of after 1000 miliseconds. Can you see what's wrong with the code?
Isn't the time that you turned the pins on the event time of interest, not the time loop() started?
johnwasser posted before I did, but his event time variable names make no sense now. Do as he suggests, but use better names. There is NOTHING magic about millis in the name, so dump it if it makes it easier to understand the code. now and pinOneTime, perhaps.