Help Ethernet Shield IP issue

Hello everyone ! I have a problem with my shield (Ethernet Shield V2) on my Arduino Uno R3. When I put an IP address for the shield, this stays at 0.0.0.0. I’ve read some posts around here, tried some things like disabling the SD card slot but the issue remains.

#include <EthernetV2_0.h>
#include <SPI.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server(173,194,33,104); // Google
IPAddress ip(192,168,0,151);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;
#define W5200_CS 10
#define SDCARD_CS 4
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
pinMode(SDCARD_CS,OUTPUT);
digitalWrite(SDCARD_CS,HIGH);//Deselect the SD card

// start the Ethernet connection:
Ethernet.begin(mac,ip,gateway,gateway,subnet);
// give the Ethernet shield a second to initialize:
delay(10000);
Serial.println(Ethernet.localIP());
Serial.println(“connecting…”);

// if you get a connection, report back via serial:
if (client.connect(server, 80)) {
Serial.println(“connected”);
// Make a HTTP request:
client.println(“GET /search?q=arduino HTTP/1.0”);
client.println();
}
else {
// kf you didn’t get a connection to the server:
Serial.println(“connection failed”);
}
}

With this code, it prints in the serial monitor 0.0.0.0 and the connection fails everytime.

Could someone solve my problem please ? Have a good day.

  • You should use code tags(</>) when you post code.
  • Which Ethernet Shield do you have? Is it the Seeed Studio Ethernet Shield v2.0 or similar with the W5200 chip or is it the Ethernet Shield 2 with the W5500 chip?
  • If it’s a shield with W5200, are you using the latest version of the EthernetV2_0 library found here: GitHub - Seeed-Studio/Ethernet_Shield_W5200: Seeed Studio Ethernet Shield V2.0 Library? There is an older version on their website that I also had problems with.
  • Other than that I’d make sure your values of mac,ip,gateway,gateway,and subnet are correct. I can just use mac and ip on my network which reduces the number of things that are possible to get wrong. The mac just has to be unique on the network so most likely that is fine but you could try a different value if all else fails.