nodeMCU - 2 loops at a time - one continuously and second every 10 seconds i have nodeMCU v3(esp8266) so i need to make 2 checks 
1 check is the pin D1 which needs to be done continuously  and another check is web link check every 10 seconds, 
problem is coz when i put delay then it stops the first check

void loop() {

 if (digitalRead(pinD1)==1){
       digitalWrite(pinD0, HIGH);
       delay(20000);  
 }else{
       digitalWrite(pinD0, LOW);
 }

      loop2();  

}



void loop2(){
   if (json1=="ON"){
    digitalWrite(pinD0, HIGH);
      delay(20000);  
}else{
     digitalWrite(pinD0, LOW);
               delay(10000);  

  }
}
Rather than using delay, use millis() and a variable to check if the some time has expired

void loop()
{
    static int check = 0;
    int now = millis();
    if (now &gt;= check) {
        if (digitalRead(pinD1)==1){
            digitalWrite(pinD0, HIGH);
            check = now + 20000;  
        } else {
            digitalWrite(pinD0, LOW);
            check = now;
        }
    }
    loop2();  
}

void loop2()
{
    static int check = 0;
    int now = millis();
    if (now &gt;= check) {
        if (json1=="ON"){
            digitalWrite(pinD0, HIGH);
        } else {
            digitalWrite(pinD0, LOW);
        }
        check = now + 20000;
    }
}