Checking Status of Arduino Ehternet 2 Shield

Im trying to use a pair of Ethernet 2 shields to communicate between two Arduino Mega's. I can't get the sample programs to run. In the UDP example's setup function, there are references to constansts and class members. It routinely returns error messages such as:

  • 'class EthernetClass' has no member named 'linkStatus''class EthernetClass' has no member named 'linkStatus'
  • 'class EthernetClass' has no member named 'linkStatus''class EthernetClass' has no member named 'lhardwareStatus'
  • error: 'LinkOFF' was not declared in this scope
  • and various similar errors...

I've included all combinations of the libraries of <Ethernet.h>, <Ethernet2.h>,<EthernetUDP.h> and <EthernetUDP2.h>.

// sends a message first
#define parm1 0x01
#define parm2 0x02
#define debugDelay 2500
#define Halt while(true)
#define Forever while(true)
boolean start = true;

#include <SPI.h>
#include <Ethernet2.h>
#include <EthernetUDP2.h>

char UDPRecvBuffer[UDP_TX_PACKET_MAX_SIZE];
char UDPSendBuffer[] = "ack";
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xFE, 0x00 };
byte local_IP[4];
byte remote_IP[4];
unsigned int localPort = 8888;
int packetSize;
EthernetUDP Udp;

byte localScriptToken;
int remote_message = 0;

void setup() {

  Ethernet.init(10);  // Most Arduino shields
  byte EthernetID = parm1; //debug
  byte remoteID = parm2; //debug

  // EthernetID read in setup
  mac[4] = EthernetID;
  IPAddress local_ip( 10, 1, 1, EthernetID );
  IPAddress remote_IP(10, 1, 1, remoteID);
  Ethernet.begin(mac, local_ip);
   // Check for Ethernet hardware present
  if (Ethernet.hardwareStatus() == EthernetNoHardware) { // errors upon compile
    Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
    Halt;
  }
   if (Ethernet.linkStatus() == LinkOFF) { // errors upon compile
    Serial.println("Ethernet cable is not connected.");
  }

  Udp.begin(localPort);

  Serial.begin(9600);
}

void loop() {
  // code here that I never reach
  Halt;
}

Those are functions of the official Ethernet library, version 2.0.0. You can't use those functions with the Ethernet2 library.

Aaannnnddd, I just discovered that...

So using the Ethernet2 library, how do you check that the Ethernet port is operational? And have a valid Ethernet connection? And so on and so forth... (valid UDP service? valid UDP connection?)...

I have two Arduino Megas with two Ethernet cards, connected via a crossover cable.

I just want to send a few bytes between the Megas as a first step and cannot. I've attached two sketches even though I know they don't work so you guys can see what Im trying...

Interact_comms_test2_ver2.ino (1.41 KB)

Interact_comms_test1_ver2.ino (3.84 KB)