Pages: [1]   Go Down
Author Topic: EtherCard and Ethernet Library conflict  (Read 1294 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 125
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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:
#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);
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 613
Posts: 49270
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 125
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 613
Posts: 49270
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 125
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: