Error ICMPPing en implementacion

Encuentro este error al compilar la solución de este esquema. Solo quiero recibir el ping a una IP especifica y todas las librerías que he probado me da error...
Alguna que Uds. han probado y funcione.
Empleando Arduino Mega 2650 y Ethernet Shield 5100.
Desde ya muchas gracias y disculpen.
Saludos
Miguelsag

Moderador:
Bienvenido al Foro Arduino en Español.
Por favor, lee las Normas del foro y edita tu código o error usando etiquetas de código.
Ve a edición, luego selecciona todo el error que has publicado, lo cortas y click en </>


No uses capturas para mostrar errores, mas allá que podamos verlos.
Coloca además tu código y aparte el error. De ese modo podes ver de qué se trata.
Indica el link de la librería o dinos si se puede extraer del administrador de librerías.
Gracias.
PD: no sigas respondiendo sin antes editar lo que te he pedido.

Bien sintetizando, busque la librería correspondiente al autor que publico en GitHub el articulo referente al uso de Ping para Ethernet.

Descargue el Zip y actualice la librería con ese zip.
Cargue de la carpeta de esa librería el ejemplo que trae.... y bueno sale ese error...
Espero puedan probar con esto. Muy amables. Gracias
MiguelSag

/*
  Ping Example
 
 This example sends an ICMP pings every 500 milliseconds, sends the human-readable
 result over the serial port. 

 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 
 created 30 Sep 2010
 by Blake Foster
 
 */

#include <SPI.h>         
#include <Ethernet.h>
#include <ICMPPing.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; // max address for ethernet shield
byte ip[] = {192,168,2,177}; // ip address for ethernet shield
IPAddress pingAddr(74,125,26,147); // ip address to ping

SOCKET pingSocket = 0;

char buffer [256];
ICMPPing ping(pingSocket, (uint16_t)random(0, 255));

void setup() 
{
  // start Ethernet
  Ethernet.begin(mac, ip);
  Serial.begin(9600);
}

void loop()
{
  ICMPEchoReply echoReply = ping(pingAddr, 4);
  if (echoReply.status == SUCCESS)
  {
    sprintf(buffer,
            "Reply[%d] from: %d.%d.%d.%d: bytes=%d time=%ldms TTL=%d",
            echoReply.data.seq,
            echoReply.addr[0],
            echoReply.addr[1],
            echoReply.addr[2],
            echoReply.addr[3],
            REQ_DATASIZE,
            millis() - echoReply.data.time,
            echoReply.ttl);
  }
  else
  {
    sprintf(buffer, "Echo request failed; %d", echoReply.status);
  }
  Serial.println(buffer);
  delay(500);
}


Error IDE Version 1.8.7

Arduino:1.8.7 (Windows 10), Tarjeta:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Ping:26:51: error: no matching function for call to 'ICMPPing::ICMPPing(SOCKET&, uint16_t)'

 ICMPPing ping(pingSocket, (uint16_t)random(0, 255));

                                                   ^

In file included from C:\Users\Kelix\Documents\Arduino\Arduino-Ping-master\Arduino-Ping-master\icmp_ping\examples\Ping\Ping.ino:17:0:

C:\Users\Kelix\Documents\Arduino\libraries\Arduino-Ping-version1.0/ICMPPing.h:28:2: note: candidate: ICMPPing::ICMPPing(SOCKET)

  ICMPPing(SOCKET s); // construct an ICMPPing object for socket s

  ^

C:\Users\Kelix\Documents\Arduino\libraries\Arduino-Ping-version1.0/ICMPPing.h:28:2: note:   candidate expects 1 argument, 2 provided

C:\Users\Kelix\Documents\Arduino\libraries\Arduino-Ping-version1.0/ICMPPing.h:25:7: note: candidate: constexpr ICMPPing::ICMPPing(const ICMPPing&)

 class ICMPPing

       ^

C:\Users\Kelix\Documents\Arduino\libraries\Arduino-Ping-version1.0/ICMPPing.h:25:7: note:   candidate expects 1 argument, 2 provided

C:\Users\Kelix\Documents\Arduino\libraries\Arduino-Ping-version1.0/ICMPPing.h:25:7: note: candidate: constexpr ICMPPing::ICMPPing(ICMPPing&&)

C:\Users\Kelix\Documents\Arduino\libraries\Arduino-Ping-version1.0/ICMPPing.h:25:7: note:   candidate expects 1 argument, 2 provided

C:\Users\Kelix\Documents\Arduino\Arduino-Ping-master\Arduino-Ping-master\icmp_ping\examples\Ping\Ping.ino: In function 'void loop()':

Ping:37:3: error: 'ICMPEchoReply' was not declared in this scope

   ICMPEchoReply echoReply = ping(pingAddr, 4);

   ^

Ping:38:7: error: 'echoReply' was not declared in this scope

   if (echoReply.status == SUCCESS)

       ^

Ping:38:27: error: 'SUCCESS' was not declared in this scope

   if (echoReply.status == SUCCESS)

                           ^

exit status 1
no matching function for call to 'ICMPPing::ICMPPing(SOCKET&, uint16_t)'

Yo creo que te convendría tratar de contactarte con el autor de la librería y exponerle el problema.

Saludos

Hola buen dia, muchasa gracias por tu tiempo.
Saludos

Yo creo que deberías observar que la librería .cpp y .h dicen 6 años.
Entonces algo que tiene ese tiempo sin ajustes requiere una de tres alternativas.

  1. La propuesta de @anon90500195 ya expuesta, aunque dudo que obtengas resultados.
  2. bajarse un IDE de hace 6 o 4 años en ese margen o incluso 3, o sea, no ir mas arriba de versiones 2018 del IDE.
  3. Ponerse a ver que ocurre que es lo que estas preguntando asi que no aporto mucho.

Resumiendo:
Viendo el foro, hay preguntas similares sin solución por todos lados.
Nadie recurre a lo obvio que es usar un IDE mas de la época según mi punto de vista.
La W5100 esta casi en deshuso, es mas facil encontrar soluciones para el módulo W5500 ver link
Algo para probar de StackExchange

Bueno instalare en otra maquina un IDE Anterior junto con las librerías correspondientes.
Desde ya muchas gracias por su tiempo y dedicación.
Saludos
Miguel Sag

Prueba esto tmb antes de lo del IDE, tal vez funcione. link

No es necesario, crea una versión portable, está explicado el la página de descarga y es muy fácil.

Saludos

Hola buen día, Uds tienen algún enlace donde descargar la librería EthernetUdp.h
No logro encontrar esa librería. En Github aparecen referencias pero no para descargarla.

Hola buen día, Uds tienen algún enlace donde descargar la librería EthernetUdp.h
No logro encontrar esa librería. En Github aparecen referencias pero no para descargarla.

También encontré esto del siguiente enlace: Ethernet UDP.
Pero no encuentro esa librería, les escribí a los autores pero no obtengo respuesta.

#include <Ethernet.h> //Load Ethernet Library
#include <EthernetUdp.h> //Load the Udp Library
#include <SPI.h> //Load SPI Library
#include "Wire.h" //imports the wire library
 
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress subnet(255, 255, 255, 0); // set subnet mask to match your network
IPAddress ip(192, 168, 0, 201); // where xx is the desired IP Address
IPAddress gateway(192, 168, 0, 1); // set gateway to match your network
unsigned int localPort = 5000; // Assign quea port to talk over
char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //dimensian a char array to hold our data packet
String datReq; //String for our data
int packetSize; //Size of the packet
EthernetUDP Udp; // Create a UDP Object
 
void setup()
{
  Serial.begin(9600); //Initialize Serial Port 
  Ethernet.begin( mac, ip); //Inialize the Ethernet
  Udp.begin(localPort); //Initialize Udp
  delay(1500); //delay 
  Serial.println(Ethernet.localIP());
}
 
void loop()
{ 
  packetSize =Udp.parsePacket(); //Reads the packet size
  
  if(packetSize>0) { //if packetSize is >0, that means someone has sent a request
    
    Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE); //Read the data request
    String datReq(packetBuffer); //Convert char array packetBuffer into a string called datReq
    
    if (datReq =="Numero") 
    { 
      int num = random (0,100) ;
      Serial.print("Numero enviado: ");
      Serial.println(num);
      
      Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); //Initialize packet send
      Udp.print(num); //Send 
      Udp.endPacket(); //End the packet   
    }
    
  }
  memset(packetBuffer, 0, UDP_TX_PACKET_MAX_SIZE); //clear out the packetBuffer array
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.