How to read sound sensor readings and light up sensor with water sensor if the readings is above threshold & when water is detected for 2 mins?
You set a timestamp when the sound first exceeds the threshold and only set the output high when millis() - firstDetect &gt; 2*60*1000

//add to globals
bool wasOver;
unsigned long firstDetect;

//replace if else
if ((ssanalogread &gt; threshold)){
   if(!wasOver){
       firstDetect = millis();
   }
   if(millis() - firstDetect &gt; 2*60*1000){
      digitalWrite(led,HIGH); //turns led on if the sensor reads more than threshold
   } //end if
   wasOver = true;
} else {
   wasOver = false;
   digitalWrite(led,LOW); 
}