[SOLVED] Arduino Duemilanove - Ethernet Shield 1.1 - LocalIP() = 0.0.0.0

I have never done anything with Arduino and Ethernet.

I have plugged in an ethernet shield and my network is on 192.168.2.x

The cable works fine issuing a DHCP address to my laptop.

But my arduino returns 0.0.0.0 in the setup routine (Ethernet.LocalIP()) and does not answer on the configured IP Address. I have chosen some random Mac Addresses incase of unknown conflict.

The Green LED on the Ethernet plug on the shield is lit. And the orange led is flickering so there is life. Also the power led on the ethernet board is lit.

I am using Arduino IDE 1.0.1

I am really not sure what to do?

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

byte mac[] = {  0xDD, 0xAD, 0xBE, 0xEF, 0xFE, 0xEE };
IPAddress ip(192,168,2, 197);

EthernetServer server(80);

void setup()
{
	Serial.begin(9600);

	Serial.println("Ethernet Begin");
  	Ethernet.begin(mac, ip);
	Serial.println("server");
	server.begin();

	Serial.print("server is at ");
	Serial.println(Ethernet.localIP()); 
}

void loop()
{

  /* add main program code here */
	// Is there any client requests?
	// listen for incoming clients
	EthernetClient client = server.available();
	if (client) {
		Serial.println("new client");
		// an http request ends with a blank line
		boolean currentLineIsBlank = true;
		while (client.connected()) {
			if (client.available()) {
				char c = client.read();
				Serial.write(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");
					client.println("Connnection: close");
					client.println();
					client.println("<!DOCTYPE HTML>");
					client.println("<html>");
					// add a meta refresh tag, so the browser pulls again every 5 seconds:
					client.println("<meta http-equiv=\"refresh\" content=\"5\">");
					// output the value of each analog input pin
					for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
						int sensorReading = analogRead(analogChannel);
						client.print("analog input ");
						client.print(analogChannel);
						client.print(" is ");
						client.print(sensorReading);
						client.println("
");       
					}
					client.println("</html>");
					break;
				}
				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
		delay(1);
		// close the connection:
		client.stop();
		Serial.println("client disonnected");
	}

}

Any help appreciated.

Chris

What is the Arduino with Ethernet shield connected to? Have you told that device about the Arduino's use of that IP address?

Don't know if you found the problem, but have you tried the DhcpAddressPrinter sketch in the ethernet examples?

Do you have a microSD card in the shield's slot?

Thanks for your advise - I did some more searching and found that I am using a cheap clone card with a Microchip ENC28J60 chip?

I think that this is not as powerfull as the new 5100 versions.

I found a library here http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=1&products_id=4 which works.

Thanks again - I have now purchased a new shield from EBAY - it doesn't look like the latest on Arduino site but it uses the 5100 chip.

Chris

iisfaq:
Thanks for your advise - I did some more searching and found that I am using a cheap clone card with a Microchip ENC28J60 chip?

I think that this is not as powerfull as the new 5100 versions.

I found a library here http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=1&products_id=4 which works.

Thanks again - I have now purchased a new shield from EBAY - it doesn't look like the latest on Arduino site but it uses the 5100 chip.

Chris

Could you update the link of the library which works with the ENC28J60 chip, because this link that you have already put on here does not work anymore.
Thank you!