Hello,
previousely i used an ethernet shield noname and works fine.
for fiablity reason i decided to buy an ethernet shield2.
i use the right library (ethernet2.h) with the same code as previousely.
sometimes (not always) i got the message "connexion refused" from the arduino.
my code is :
#include <SPI.h>
#include <DHT.h>
#include <Ethernet2.h>
...
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEA
};
IPAddress ip(192, 168, 1, 178);
byte gateway[] = {
192, 168, 1, 1
};
// Attachement d'un objet "server" sur le port 1337
EthernetServer server(1337);
...
void setup() {
Ethernet.begin(mac, ip, gateway);
server.begin();
...
}
void loop()
{
EthernetClient client = server.available();
if (client) {
if (client.connected()) {
// si le client nous envoie quelque chose
if (client.available()) {
// On regarde ce que le client nous demande
requ[0] = client.read();
requ[1] = client.read();
requ[2] = client.read();
...
}
}
}
delay(20);
client.stop();
}
}
could anyone help me ?