Ethernet Shield not working

Hi guys,
I have a big problem, i'm a beginner so please help me.. :frowning:
I bought an Ethernet Shield and tried this tutorial :

I didn't worked, i also tried the examples from the Arduino library.
every time it says ERR_CONNECTION_REFUSED.
I changed the ip to my ipv4 computer adress and it is not working...
Can someone fix this for me ? I have no idea.
the chip is Wiznet W5100.
Thank you

You can't use the same IP as your computer. The IPs must be unique.

Post your code.


Web Server Demo
thrown together by Randy Sarafan

A simple web server that changes the page that is served, triggered by a button press.


  • Ethernet shield attached to pins 10, 11, 12, 13
  • Connect a button between Pin D2 and 5V
  • Connect a 10K resistor between Pin D2 and ground

Based almost entirely upon Web Server by Tom Igoe and David Mellis

Edit history:
created 18 Dec 2009
by David A. Mellis
modified 4 Sep 2010
by Tom Igoe


#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac = { 0x00, 0xAA, 0xBB, 0xCC, 0xDA, 0x02 };
IPAddress ip(192,168,0,105); //<<< ENTER YOUR IP ADDRESS HERE!!!

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);

int buttonPress = 1;

void setup()
pinMode(2, INPUT);

// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);

void loop()
buttonPress = digitalRead(2);
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c =;
// if you’ve gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == ‘\n’ && currentLineIsBlank) {
// send a standard http response header
client.println(“HTTP/1.1 200 OK”);
client.println(“Content-Type: text/html”);

//serves a different version of a website depending on whether or not the button
//connected to pin 2 is pressed.
if (buttonPress == 1) {
client.println(“cke:html<cke:body bgcolor=#FFFFFF>LIGHT!</cke:body></cke:html>”);
else if (buttonPress == 0){
client.println(“cke:html<cke:body bgcolor=#000000 text=#FFFFFF>DARK!</cke:body></cke:html>”);

if (c == ‘\n’) {
// you’re starting a new line
currentLineIsBlank = true;
else if (c != ‘\r’) {
// you’ve gotten a character on the current line
currentLineIsBlank = false;
// give the web browser time to receive the data
// close the connection:

My coputer ip is the same “192,168,0,105”;
With what should i replace ?
Thank you a lot @SurferTim

If you are using an Ethernet shield, you must use the ICSP pins. Nothing connected to D11 to D13 on the shield.