Go Down

Topic: EtherCard and Ethernet Library conflict (Read 1 time) previous topic - next topic

durkinnj

I am using the Ethernet library to use the arduino as a webserver. I am adding to the program to make it send a magic packet to wake a laptop on the network. I get this error when trying to merge the two:

Code: [Select]
In file included from C:\arduino-1.0.3\libraries\EtherCard/EtherCard.h:27,
                 from Carduino_002.ino:11:
C:\arduino-1.0.3\libraries\EtherCard/enc28j60.h:44: error: 'typedef class ENC28J60 Ethernet' redeclared as different kind of symbol
C:\arduino-1.0.3\libraries\Ethernet/Ethernet.h:39: error: previous declaration of 'EthernetClass Ethernet'
In file included from Carduino_002.ino:11:
C:\arduino-1.0.3\libraries\EtherCard/EtherCard.h:122: error: expected class-name before '{' token
Carduino_002:14: error: 'Ethernet' is not a class or namespace


Here is the beginning code:

Code: [Select]
#include <SPI.h>
#include <Ethernet.h>
#include <EtherCard.h>
static byte mymac[] = {0x00,0x1A,0x4B,0x38,0x0C,0x5C};
static byte targetmac[] = {0x00,0x1D,0x92,0x53,0x53,0xDC};
byte Ethernet::buffer[7700];

byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = {
  192, 168, 0, 80 }; // ip in lan
byte gateway[] = {
  192, 168, 0, 1 }; // internet access via router
byte subnet[] = {
  255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port


And then all I'm doing is using a command to send the request which is:

ether.sendWol(targetmac);

PaulS

The Ethernet library is for use with the W5100 chip. The EtherCard library is for the ENCJxxxx chip. Which ONE do you have? Why are you trying to use both?

durkinnj

I have the w5100 but I am using the ethercard library so I can use the wol function. does the ethernet library have a command that allows me to send a wake on lan packet?

PaulS

Quote
I am using the ethercard library so I can use the wol function.

You're going to need to figure out how the ethercard library does that (not too difficult, as you have the source) and replicate that in the ethernet library or the sketch.

durkinnj

ah okay. Didn't realize ethercard was for a different ethernet shield. Thanks for the help (:

Go Up