how to use the web server example

hello, I bought a Ethernet shield and I'm stuck i gave it a IP address that was one digit different to my routers ip address so it was 87 instead of 86. I am using windows 8 x64 and have a BT router. I have a couple of questions?

  1. do I have to use the mac address that's printed on the board?
  2. does the Ethernet cable go into you computer or into the router
  3. how do I assign a IP address to the Ethernet board because I get this error when investigating the problem: Ethernet doesn't have a valid IP configuration
  4. can you use and internet browser to enter the IP address into
  5. how do you type the IP address into the browser

I really appreciate any help!

different to my routers ip address so it was 87 instead of 86.

Most times, the router address is xxx.xxx.xxx.1. Are you sure your router address is xxx.xxx.xxx.86? What are xxx, xxx, and xxx?

  1. does the Ethernet cable go into you computer or into the router

The router. The whole purpose of the ethernet shield is to allow connecting to the internet without a PC.

  1. how do I assign a IP address to the Ethernet board because I get this error when investigating the problem: Ethernet doesn't have a valid IP configuration

You get that where? When? The EXACT message would be good, as would seeing your code.

  1. how do I assign a IP address to the Ethernet board because I get this error when investigating the problem: Ethernet doesn't have a valid IP configuration

I can, yes. You should be able to, too.

  1. how do you type the IP address into the browser

One digit at a time.

hello,

  1. my routers IP address is 192.168.1.86
  2. OK so I connect it to my router or Ethernet socket in the wall?
  3. I get it when I go onto control panel>network and internet>network and sharing>Ethernet (when Ethernet is connect from board to computer)>Diagnose. I am just using the webserver example sketch with IP address as 192.168.1.87
  4. ok just checking :slight_smile:
  1. OK so I connect it to my router or Ethernet socket in the wall?

Send me your house. I'll check the wiring, and get back to you. 8)

You can use the below code to test you network setup. Plug your arduino Ethernet shield into your router, upload the below code to the arduino, open the arduino IDE serial monitor, and send an e to the arduino. If you have a good network setup, you should get a response from the server.

//zoomkat 9-22-12
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields
//remove SD card if inserted

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = "web.comporium.net"; // zoomkat's test web page server
EthernetClient client;

//////////////////////

void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }

  Serial.begin(9600); 
  Serial.println("Better client test 9/22/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  }  
} 

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.1"); //download text
    client.println("Host: web.comporium.net");
    client.println("Connection: close");  //close 1.1 persistent connection  
    client.println(); //end of get request
  } 
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor 
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}