Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By martinayotte
#58256 We cannot see how do you connect the client in your code.
We only see that there is a call to connectClient() in setup(), which is not a good practice, since if the client disconnect, it won't reconnect it. You should handle that in loop() and check the status of the connection.
User avatar
By Nicklars
#58259
Code: Select allvoid connectClient(){
      while(1){
      // Check if a client has connected
      client = server.available();
      if (!client) {
        continue;
      }
 
      // Wait until the client sends some data
      Serial.println("connected");
      while(!client.available()){
       delay(1);
      }
      break;
    }
}


Code: Select allvolatile bool mpuInterrupt = false;     // indicates whether MPU interrupt pin has gone high
void dmpDataReady() {
    mpuInterrupt = true;
}


How do I reconnect to the client and where should I put this Part of my code?