Chat freely about anything...

User avatar
By DonFrench
#61446 My application makes the ESP8266 into an access point and is designed to be used interactively by a user with a smart phone. One of the functions of the app waits for a digital input to go high before reacting. The code is the following:
Code: Select all   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?
User avatar
By AcmeUK
#61461 Have you tried a Meta tag on your initial page telling the remote browser to keep refreshing the page?

Have a look at this example which refreshes the page every 30 seconds :-
Code: Select all<html>
  <head>
    <title>Your page title</title>
    <meta http-equiv="refresh" content="30;url=index.html">
  </head>
  <body>
  </body>
</html>
User avatar
By eduperez
#61467 As AcmeUK pointed out, you should design your application such as the client polls the server for updates on the status. You can use a refresh, ajax, web sockets, ... Also, you should code your sketch so you only have a loop, that both serves clients and checks for pin status.