I have a sketch that has been running just fine using the ESP8266Ping.h library. I wanted to flash a new ESP8266 with the same code but I can't get any pings to work.
Any ideas would be appreciated.
#define SKETCH "pingTest"
#define VERSION "1.00" // Four characters
/*
This program is a test of the ping function
*/
//-------------------------
#include <ESP8266Ping.h> //Includes ESP8266WiWi.h
#include <Kaywinnet.h> // WiFi credentials
char pingIP[20]; // IP that we're going to ping.
//****************************** SERIAL **************************
void beginSerial() {
Serial.begin(115200);
delay(1000);
Serial.println();
Serial.println(SKETCH);
Serial.println(VERSION);
Serial.println();
}
//****************************** WiFi **************************
void setup_wifi() {
Serial.println();
Serial.println("Connecting to ");
Serial.println(MY_SSID);
//WiFi.hostname(SKETCH);
WiFi.begin(MY_SSID, MY_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(WiFi.status());
Serial.print(" ");
}
Serial.println("\nWiFi connected, ");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
Serial.print("Hostname: ");
Serial.println(WiFi.hostname().c_str());
}
//****************************** PING **************************
void pingit() {
Serial.print(pingIP);
Serial.print(F(": "));
if (Ping.ping(pingIP)) { // Ping
Serial.println("OK");
} else {
Serial.println("Fail");
}
}
//****************************** SETUP **************************
void setup() {
beginSerial();
setup_wifi();
}
//****************************** LOOP **************************
void loop() {
strcpy(pingIP, "192.168.1.1");
pingit();
strcpy(pingIP, "192.168.1.57");
pingit();
strcpy(pingIP, "192.168.1.124");
pingit();
strcpy(pingIP, "192.168.1.183");
pingit();
strcpy(pingIP, "127.0.0.1");
pingit();
Serial.println(F("---------------"));
delay(1000);
}
is the new ESP8266 identical to the old one? give details?
is the code compiling and uploading to the new board OK?
what is printed on the serial monitor?
there are several libraries using this .h
Which library have you installed exactly?
Is the example sketch of that library working? If not - please show the serial output
I keep my libraries up to date, but in this case I tried installing an older version of ESP8266ping.h with the same results. I also tried pinger.h with the same results.
I buy my Wemos D1 Minis five or ten at a time. This problem is the same on three that I have tested, including one that had been running the same code for a couple of years.
My library is messed up. I downloaded the .cpp and.h file from Github and put them into my sketch folder, and now every ping I send to that library works fine.
Can you clarify where the library files should go? (esp8266ping.h is found in several locations). If I recall the library files are in a libraries folder in my sketchbook folder? My sketch folder is:
So, my understanding is that the .cpp and .h files should go into C:\Users\steve\Documents\Arduino\libraries\ESP8266ping