#include <WiFi.h>
#include "ESP32Ping.h" // Add some file to create my own library
//copy and paste from https://github.com/marian-craciunescu/ESP32Ping
const char* ssid = "Wokwi-GUEST";
const char* password = "";
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
}
void loop() {
// Ping in a loop with a 3-second delay
if (Ping.ping("8.8.8.8")) {
Serial.println("Ping successful");
} else {
Serial.println("Ping failed");
}
delay(3000); // Wait for 3 seconds
}