Wait for input

I guess i can't use the delay order since then the whole programm is being made to wait and it won't accept any input signals in the mean time.

You guess correctly. You can implement a while loop, and use millis().

unsigned long startTime = millis();
while(millis() - startTime < interval)
{
   // check for input. Break if found
}
// When we get here, either there was input or the time expired.