Hey, I'm doing a project in school where I will do a game where a LDR is needed to turn on and off some LEDs. Basically; When you put your hand over the LDR the value lowers, and I have made an if-statement and then a for-loop telling the LEDs to turn on when the LDR value is lower than the treashold. I want it to delay randomly between some seconds before the LEDs are turned on, that is all done. But my problem now is, when i remove my hand from the LDR it keeps delaying the same amout of time that the LEDs were turned on.

So, how can I make it so that when I take away my hand from the LDR the LEDs turns off again immediatley?

I use the Serial.begin(); and then i use the delay the intire serial monitor is delayed.