dancol90 / ESP8266Ping

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

Pings are failing #21

Open buzzy opened 6 years ago

buzzy commented 6 years ago

I made a very simple test where I connect to another ESP8266 and then try to ping it. I connect correctly and get the IP 192.168.4.2 on my "slave" ESP8266. But trying ping the "master" ESP8266 on 192.168.4.1 fails. Any idea why? If I connect to the "master" ESP8266 from my laptop, I can ping it without any issues.

include

include

include

const char ssid = "ESP8266"; const char password = "testpassword";

IPAddress ip (192, 168, 4, 1);

void setup() { Serial.begin(9600);

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
    delay(1000);
}

Serial.println(WiFi.localIP());

}

void loop() { bool ret = Ping.ping(ip); if (ret) { Serial.println("PING! PONG!"); } else { Serial.println("Failed"); }

delay(1000);

}