dancol90 / ESP8266Ping

Ping library for ESP8266 Arduino core
GNU Lesser General Public License v2.1
265 stars 136 forks source link

Pinging ip, but return false #44

Closed mpoltav2 closed 1 year ago

mpoltav2 commented 1 year ago

I'm trying to ping my phone in the same network, but the function bool pingip = Ping.ping(remote_ip, 5); returns false In Serial writes: ping 15, timeout 0, total payload 480 bytes, 15511 ms I thing ip is avalaibe but function returns false....

The whole code: bool pingme() { Serial.print("Pinging to ip\n"); bool pingip = Ping.ping(remote_ip, 15); if(pingip) { Serial.println("ping Success!!"); return true; } else { Serial.println("ping Error :("); return false; } }

Hoegrden commented 1 year ago

I had the same problem. Depending on the ESP8266 (or ESP12) core version, ping functions do not work. (Other libraries don't work the same) Try removing the board through the Arduino board manager and installing version 3.0.2.

check this. https://github.com/esp8266/Arduino/issues/8555

Additionally, if you are using an iPhone, the wifi will automatically go to sleep after screen is turned off and a certain amount of time passes.