Ethernet problem

I’m having a little trouble getting an ethernet shield going.

DFRobot Shield which uses a W5100 chip.

Board is a seeedstudio with an atmega 168 chip

Software is version 0016

Program is this, a pretty standard test from what I can see

/*
 * Web Server
 *
 * A simple web server that shows the value of the analog input pins.
 */

#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 169,254,157,229 };

Server server(80);

void setup()
{
  Ethernet.begin(mac, ip);
  server.begin();
}

void loop()
{
  Client client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean current_line_is_blank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        // if we've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so we can send a reply
        if (c == '\n' && current_line_is_blank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          
          // output the value of each analog input pin
          for (int i = 0; i < 6; i++) {
            client.print("analog input ");
            client.print(i);
            client.print(" is ");
            client.print(analogRead(i));
            client.println("
");
          }
          break;
        }
        if (c == '\n') {
          // we're starting a new line
          current_line_is_blank = true;
        } else if (c != '\r') {
          // we've gotten a character on the current line
          current_line_is_blank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    client.stop();
  }
}

On the board when the ethernet cable is plugged in to the ethernet card and the router, the 100m led is on, the Fulld is on, the Link led is on. On the router the led for that port is on too.

When it go to the address 169.254.157.229 I get nothing.

Any ideas what I’m doing wrong?

Nick

Connected to your local network, the arduino needs to be in the same subnet as your PC and router (typically 192.168.X.X) Its more likely to be a network thing than an Arduino thing. Its pretty much the same as setting up a server on a computer.

OK,

I've changed the IP address to 192,168,157,229 and reloaded the software.

No joy.

Tried one more IP address, just in case!

No joy either.

It will need to match the first three octetet of the IP address of your computer and router if your setup is typical. Assuming you have a windows box, you can find its local IP address by going to a command prompt and typing 'ipconfig' and pressing return. Set the arduino to the same but alter the last octet (number) to something else.

ipconfig

Windows IP Configuration

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix . : config Link-local IPv6 Address . . . . . : fe80::f06e:e9c:8054:9089%9 IPv4 Address. . . . . . . . . . . : 192.168.1.64 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.254

Tunnel adapter Local Area Connection* 6:

Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . :

Tunnel adapter Local Area Connection* 7:

Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : config

So In the code I've this line

byte ip[] = { 192,168,1,236 };

Still no joy :'(

Start up the arduino and try pinging it from the PC. The Wiznet chip will respond to ICMP pings without interaction of the host microcontroller (the arduino) if everyuthing is properly configured.

If it responds to a ping, the Wiz is configured correctly and something else is wrong (e.g. your sketch is broken). If not, you may be having trouble talking to the Wiz.

-j

...and if it is your sketch, try using WebDuino....

Webduino was the solution. Up and running!!! Thanks all :) :) :) Nick