Arduino Ethernet Shield

the example code was perhaps a little daunting for newbies.

to make it a bit more straightforward i've pulled out a few of the functions -- probably worth adding something like this to the library to make it simpler for those who basically just want to be able to serve webpages with dynamic values.

you can download the template here (just make sure you have the etherShield library installed; and set your IP address to one that doesn't already exist on your network).

then your setup and loop would look simply like this.....

// you can change this line if you want to serve, for example, XML or some other content type
#define HTTP_HEADER "HTTP/1.0 200 OK\r\nServer: arduino\r\nContent-Type: text/html\r\n\r\n"

void setup(){
  setupEthernet("192.168.000.060", 80);   // must include padded 0s in the IP address
}

void loop(){

  //put your code here 
   
  // then check for requests, and if so, serve the webpage  
  if (ethernetRequest()){
    writeHeader();    
    writePage("<h1>This is your Arduino speaking!</h1>");     
    writePage("<h3>Analog values:</h3>");     
    for (int i = 0; i < 6; i++){
      writePage("
");
      writePage(analogRead(i));
    }
    servePage();
  }
}

(btw, couldn't get alternative ports to work either in my example or in the original; however didn't spend a long time debugging)