BlakeFoster / Arduino-Ping

ICMP ping library for the Arduino
59 stars 44 forks source link

problem during compilation util.h no such file or directory #7

Open jfpion opened 8 years ago

jfpion commented 8 years ago

hello I want to use an arduino uno plus ethernet shied to command a relay to work as a watchdog for an adsl modem . so I intend to ping a known IP and reboot in case of freeze. the sketch is :+1:

/*
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>

define relaypin 13

int JFP=0;

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);
JFP=0;
  }
  else
  {
++ JFP;
    sprintf(buffer, "Echo request failed; %d", echoReply.status);

if (JFP== 3)
{ 
digitalWrite  (relaypin , HIGH);
delay (2000);
digitalWrite  (relaypin , LOW);
JFP=0;
}
}
  Serial.println(buffer);
  delay(500);
}

it is straight from the example

but i get an error during the compilation

C:\Program Files (x86)\Arduino\libraries\icmp_ping\ICMPPing.cpp:11:18: fatal error: util.h: No such file or directory

include

what dit i wrong ? where is the util.h ?

thank you

jfpion commented 8 years ago

I found the pb . the utils.h is in the last github version but not in the one linked in the arduino documentation (the link here is https://github.com/BlakeFoster/Arduino-Ping/archive/version2.0.zip )