while(digitalRead(DIGITAL_IN) != 1){
delay(1);
}
doYourThing( );
And this works - it does its thing when the input goes high, no matter how long it takes for that to happen. But while waiting, the client on the smart phone loses the connection and the user has to reboot the ESP8266 to regain access. But so far I haven't found a way to keep the client alive. Any ideas on how to do this?