PaulS:
void loop() {
randomSeed(analogRead(5));
randomSeed() should be called once, not on every pass through loop().while(endTimer - startTimer <=n){
random_LED = array_LED[random(0,3)];
delay(random(0,2000));
digitalWrite(random_LED, HIGH);
switch(random_LED){
case LEDpin_RED:
LED(BUTTONpin_RED,LEDpin_RED);
When you return from LED, you return to this while loop. The while loop has no idea that you want to quit. LED needs to return a value, and you need to test that value, to decide whether or not to break out of the while loop.
Thank you very much, worked out perfectly ![]()