Open gabrielbravov opened 3 months ago
Thank you for your comments and observations. I never tested the class neither with ethernet nor with Platform.io.
I'll take a look at it in the following days. I might still have an ESP32 board with an ethernet socket somewhere ...
Hello friend,
first of all, thanks for the work. I was searching a great icmp library with arduino compatibility a lot of time and your library work flawlessly with Arduino Framework.
¿how can i use it with Ethernet instead of wifi? using Arduino Ethernet Library and W5500 ic.
I tried this code in platformio, but it crashed and goes into reboot loop.
`//Ejemplo de https://github.com/BojanJurca/Multitasking-Esp32-ping-class
include
include "ESP32_ping.hpp"
include // Ethernet library
IPAddress local_IP(192, 168, 10, 126); // Set your Static IP address IPAddress gateway(192, 168, 10, 1); // Set your Gateway IP address IPAddress subnet(255, 255, 255, 0); //subnetmask
// Enter a MAC address and IP address for your controller below. byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xDE }; EthernetClient clienteth; //Generamos objeto de la clase Ethernet
void setup () { Serial.begin (9600); while (!Serial) delay (10); delay (1000);
// WiFi.begin ("yourwifi","yourpw"); // use your WiFi credentials
// Serial.print ("\nConnecting "); // while (WiFi.status () != WL_CONNECTED) { // delay (500); // Serial.print ("."); // } // Serial.print ("\nConnected, STAtion IP: "); // Serial.print (WiFi.localIP ()); // Serial.print(", route's IP: "); // Serial.println (WiFi.gatewayIP ());
Ethernet.init(5); // SS pin for spiV Ethernet.begin(mac, local_IP); // start the Ethernet connection delay(1000); // give the Ethernet shield a second to initialize Serial.print("Direccion IP: "); Serial.println(Ethernet.localIP());
// example 1: simple router pinging Serial.println (); esp32_ping simplePing;
// simplePing.ping (WiFi.gatewayIP ()); if (simplePing.error() != ERR_OK) { Serial.printf ("Error %i\n", simplePing.error ()); } else { Serial.printf ("Ping statistics for %s:\n" " Packets: Sent = %i, Received = %i, Lost = %i", simplePing.target ().toString ().c_str(), simplePing.sent (), simplePing.received (), simplePing.lost ()); if (simplePing.sent ()) { Serial.printf (" (%.2f%% loss)\nRound trip:\n" " Min = %.3fms, Max = %.3fms, Avg = %.3fms, Stdev = %.3fms\n", (float) simplePing.lost () / (float) simplePing.sent () * 100, simplePing.min_time (), simplePing.max_time (), simplePing.mean_time (), sqrt (simplePing.var_time () / simplePing.received ())); } else { Serial.printf ("\n"); } }
}
void loop () {
} `
Serial output:
17:18:35.182 > ����q-����A�Direccion IP: 192.168.10.126 17:18:38.016 > ####################### 17:18:38.042 > Ejemplo 1: Pingueo simple al gateway 17:18:38.082 > 17:18:38.084 > 17:18:38.086 > assert failed: tcpip_send_msg_wait_sem IDF/components/lwip/lwip/src/api/tcpip.c:455 (Invalid mbox) 17:18:38.190 > 17:18:38.192 > 17:18:38.194 > Backtrace: 0x40083571:0x3ffb1f30 0x4008827d:0x3ffb1f50 0x4008d1d5:0x3ffb1f70 0x400e0a4e:0x3ffb20a0 0x400ec015:0x3ffb20d0 0x400dfca1:0x3ffb2110 0x400d24f3:0x3ffb2150 0x400d27b1:0x3ffb2170 0x400d64ea:0x3ffb2290 17:18:38.413 > 17:18:38.415 > 17:18:38.417 > 17:18:38.419 > 17:18:38.421 > ELF file SHA256: 1bfdffd2f84a0cc6 17:18:38.458 > 17:18:38.460 > Rebooting... 17:18:38.475 > ,� �)b��C5� * Terminal will be reused by tasks, press any key to close it.
This it's the platformio.ini content: `; PlatformIO Project Configuration File ; ; Build options: build flags, source filter ; Upload options: custom upload port, speed and extra flags ; Library options: dependencies, extra library storages ; Advanced options: extra scripting ; ; Please visit documentation for the other options and examples ; https://docs.platformio.org/page/projectconf.html
[env:esp32dev] platform = espressif32 board = esp32dev framework = arduino
monitor_speed = 9600 monitor_filters = time
lib_deps =
RECOMMENDED
Accept new functionality in a backwards compatible manner and patches
arduino-libraries/Ethernet @ ^2.0.2`