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;
}