Okay, here's a interesting problem. I used the Web server example, to monitor 8 simple pushbuttons, and display their state
over the ethernet to a computer. My only modification, was converting the analogRead to digital Read, and directing input
from the 8 available digital pins, to the ethernet output. Using 8 sets of simple button circuits...

and using the following code..
/*
button Web Server
A simple web server that shows the value of the digital input pins.
using an Arduino Wiznet Ethernet shield.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
* digital inputs 2 through 9, 10K pulled to GND, pushbutton to +5V
main code created 18 Dec 2009 by David A. Mellis
modified 4 Sep 2010 by Tom Igoe
* modified 22 Aug 2011 from analog read to digital read by Stephen Griswold
*/
#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[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,1, 177 };
// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
Server server(80);
void setup()
{
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
for (int digitalChannel = 2; digitalChannel < 10; digitalChannel++) {
pinMode(digitalChannel, INPUT); //make sure pins are in imput mode
}
}
void loop()
{
// listen for incoming clients
Client client = server.available();
if (client) {
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
// 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();
// output the value of each digital input pin
for (int digitalChannel = 2; digitalChannel < 10; digitalChannel++) {
client.print("digital input ");
client.print(digitalChannel);
client.print(" is ");
client.print(digitalRead(digitalChannel));
client.println("<br />");
}
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();
}
}
Problem is... the program seems to be ignoring the button states, and sending a semi random pattern.
(with all the Port# = stuff removed)
01111100 00111100 00011110 00001111 10001111 11000011 11110001 11110000 from the digitalRead.
Every time I reload the page on the receiving computer, it gives a different set, where it should be all zeros (if no buttons pushed,) or a 1 where one of the buttons is..
I've even tried revering the state, pulling the digital pins high with the 10K resistors, and the switch to GND, But it still gives the same result.
This is just the beginning of a experiment to use the ethernet shield as a link through a WiFi router, to monitor a robot project, and as most newbies, I'm building the main program in modules, getting each part to work. I'm using a Duemilanove as the test-bed, and plan on moving the code segments (modules) as I finish them, to a MEGA-2560 once I'm sure the different parts work. (more digital pins available)
It almost seems like there's some kind of artifact signals left from taking to the D10 to 13 pins, to the ethernet shield.
I don't know if this has been covered yet, or not.. and it's very frustrating!
Stephen (gelfling6)