pbecchi / esp32_ping Goto Github PK
View Code? Open in Web Editor NEWPing library for ESP32
Ping library for ESP32
Work fine, but after using the ESP32 a few hours it´s resets. Debugging i´ve found everytime i use ping_start(), eats 56 bytes of memory, resulting in a run out memory after a few hours working.
Here is the little piece of code i´m using to check my gateway:
if (ping_start(WiFi.gatewayIP(), 1, 0, 0, 5)) {PingCount=0; lcd.setCursor (10,0); lcd.print ((char)4);}
else {PingCount++; lcd.setCursor (10,0); lcd.print (" ");}
any ideas? thanks a lot
I am trying to complete a project in Arduino IDE using an ESP32 (mini kit MH ET Live).
Once a day, the code updates an RTC through NPT. The problem is that if there is no internet connection, the code stops.
To use a conditional that omits this instruction, I would need to verify that there is not an active connection to the Internet. I've thought about sending a ping and waiting for its return, but I have not found a library that works well for ESP32. I tried the libraries and the examples of ESP32_ping and ESP32Ping without success. The pbecchi library now gives an error that says it can not compile for the module that I use.
I would like to know how else I can verify that the ESP32 has an Internet connection.
I am a newbie in this field with three months since I started learning how to program. Hope someone can help me.
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);
}
Thanks a lot for excellent library.
It works fine on ESP32, no compiler error.
Because something wrong on my PC, I did fresh install Windows 10 and Arduino IDE 1.8.8.
But after fresh install, ESP32 Ping doesn't work anymore.
Arduino IDE Compiler error in Ping.cpp line:
inet_addr_from_ipaddr(&to.sin_addr, addr);
The error message: 'inet_addr_to_ipaddr' was not declared in this scope
It seems this error cause by broken lwip library.
ESP32 Ping use 2 separate lwip libraries (Arduino library in C:\Program Files (x86)\Arduino and ESP32 library in C:\Users\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.1\tools\sdk\include\lwip\lwip folder).
But somehow the library connection is broken and cause 'inet_addr_to_ipaddr' was not declared in this scope error
Instead using Board Manager to install ESP32 package, also tried install ESP32 package by using git, but didn't help either. Still 'inet_addr_to_ipaddr' was not declared in this scope error
How to fix this error?
Please help...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.