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.