pbecchi / ESP32_ping

Ping library for ESP32
15 stars 13 forks source link

i hope this helps someone(: #2

Open oL0ck opened 6 years ago

oL0ck commented 6 years ago

void setup() {

Serial.begin(115200);
Serial.print("Connecting t ");
Serial.println(ssid);
// WiFi.mode(WIFI_STA);

WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.print("We got IP: "); Serial.println(WiFi.localIP()); Serial.print("And gateway: "); Serial.println(WiFi.gatewayIP()); }

// the loop function runs over and over again until power down or reset void loop() { Serial.print("For testing wifi we can always just ping the gateway"); if (ping_start(WiFi.gatewayIP(), 4, 0, 0, 5)) Serial.println("OK"); else Serial.println("FAILED"); delay(10000);

}