Post topics, source code that relate to the Arduino Platform
User avatar
By WijdanMTak
#76742 Hi,
I'm trying to connect my raspberry to esp, by making esp as an "AP and WiFi server " to send values to raspberry,
And hopefully, the connection success and raspberry start to receive values, but after a short, while the esp logs out from the loop of client connection and disconnect (not all tries, but almost).
------------------>
Although, raspberry still receiving none instead of values...
And I have to mention that if I put client. available into my client. connected loop, the esp doesn't log on it and do what it is inside. .. just log on the loop and do what it is inside and just for a short while...
<-------------------
here you are the loop section:
Code: Select allvoid loop() {
  WiFiClient client = server.available();
  //Serial.println("searching on client...");
  if(!client)
  {
    //Serial.println("no client");
    return;
  }
  Serial.println("new client");
   
  while(client.connected())
  {
    Serial.println("sending to new client : HI");
    Serial.println(client.print("Hi"));
    //ٌRaspberry receives this message
    //just few times, for unknown reason
  }
  delay(2);
  client.stop();
}

Looking forward to hearing suggestions.
Regards