I’m hoping someone can help me; I have developed a code using the Ethernet2 library, which works perfectly. I will paste the code below
#include <SPI.h>
#include <Ethernet2.h>
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 1, 177);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 0, 0);
EthernetServer server(23);
String readString;
void setup() {
// initialize the ethernet device
Ethernet.begin(mac, ip, gateway, subnet);
// start listening for clients
server.begin();
// Open serial communications and wait for port to open:
Serial.begin(9600);
}
void loop() {
EthernetClient client = server.available();
while (client.available()> 0) {
char c = client.read();
readString += c; //makes the string readString
delay(5); //slow looping to allow buffer to fill with next character
}
readString=""; //empty for next input
}
The code above as stated works perfectly, however my issue is that I now need to use the Ethercard library.
I need my code that uses the Ethercard library, to duplicate the function as the code above.
I have tried different ways in trying to achieve this and have failed.
I’m hoping someone can help me or show me a guide in how to do this.
the code does a lot more, however i need to focus on setting up an ip and a port so i can send values to and from the arduino. the reason the hardware was changed was due to a constraint, so i had to develop a hardware interface using the ENC28J60 which as you know requires a different library then Ethernet2.
well i did state that i had to develop a standalone version of the ENC28J60 Ethernet controller,
Yes, but you did not say what happens when you run the code. If you had posted in the hardware section, I'd be focusing on the hardware. Since you didn't, I'm assuming that the hardware is OK. May not be a reasonable assumption, but you haven't given enough information yet.
PaulS:
Yes, but you did not say what happens when you run the code. If you had posted in the hardware section, I'd be focusing on the hardware. Since you didn't, I'm assuming that the hardware is OK. May not be a reasonable assumption, but you haven't given enough information yet.
I do apologize for not being very accurate on the information i have given, im hoping with this it might make it clearer.
as you know the Ethernet2 library has these functions
Hi. Did anyone find something? I'm currently working in the same thing. Firstly, and sadly, I have to say:this community does everything, but not helping. I made and extensive research and every time I hit a link the arduino forums, I had nothing but people blaming other for "not sufficient information" or "you did it wrong". Not a single help and "oh, you have to do this and that". Anyone that doesn't have a helping response should not reply.
Now, vj01, I'm stuck in the same problem. I'm trying to setup an IP address with Arduino Nano and HanRun HR911105A 12/08 Ethernet Module. I've tried with Ethernet.h and couldn't get anything. But when I try with this EtherCard it does not have the other things i need (like client and such). Other thing: if I try to use both, it gives a conflict with
typedef class ENC28J60 Ethernet' redeclared as different kind of symbol
My code is the same as vj01's one.
If anyone tried something different or has a hint of something... Things I already tried:
There are two basic Ethernet modules. One uses the W5100 chip that does an awful lot of the work needed to communicate with the ethernet. The other uses the ENC28J60 that requires that YOU do all the work.
If you don't know how, just how useful was it to save a nickel on the ENC28J60?
Got it working with the UIPEthernet library for arduino. There are others depending on the use, like Ethercard or ETHER_28J60, but if you need the same functions as Ethernet, then UIPEthernet is ok.