I have an Arduino Uno with an Ethernet shield. I have installed the ICMPPing library and trying to use the included example. Changed my IP address, etc.
/*
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[] = {10,1,1,177}; // ip address for ethernet shield
IPAddress pingAddr(10,1,1,101); // 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);
}
When I try to load the sketch I get the following error message.
Arduino: 1.5.6-r2 (Windows 7), Board: "Arduino Uno"
E:\Program Files (x86)\Arduino\libraries\ICMPPing\ICMPPing.cpp: In member function 'void ICMPEcho::serialize(uint8_t*) const':
E:\Program Files (x86)\Arduino\libraries\ICMPPing\ICMPPing.cpp:71: error: 'htons' was not declared in this scope
E:\Program Files (x86)\Arduino\libraries\ICMPPing\ICMPPing.cpp:74: error: 'htonl' was not declared in this scope
E:\Program Files (x86)\Arduino\libraries\ICMPPing\ICMPPing.cpp: In member function 'void ICMPEcho::deserialize(const uint8_t*)':
E:\Program Files (x86)\Arduino\libraries\ICMPPing\ICMPPing.cpp:84: error: 'ntohs' was not declared in this scope
E:\Program Files (x86)\Arduino\libraries\ICMPPing\ICMPPing.cpp:90: error: 'ntohl' was not declared in this scope
E:\Program Files (x86)\Arduino\libraries\ICMPPing\ICMPPing.cpp: In member function 'void ICMPPing::receiveEchoReply(const ICMPEcho&, const IPAddress&, ICMPEchoReply&)':
E:\Program Files (x86)\Arduino\libraries\ICMPPing\ICMPPing.cpp:219: error: 'ntohs' was not declared in this scopeThis report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Fairly new at this. Any suggestions?
thanks