Ethernet remote monitoring the Arduino R3 inputs

I picked up the Book “Arduino WorkShop” by John Boxall. I purchased the JBtek Ethernet Shield W5100 Micro-sd Card Slot and installed it on my Arduino UNO R2. I am working on Project #60 Building a Remote Monitoring Station. I should be able to put the ip address 192.168.0.69 in my web browser and receive back information from the Arduino, but i get nothing back. I can see activity when I enter the ip addres, from the serial monitor but nothing on the web browser. (I am using GOOGLE Chrome.) it looks like the Ethernet shield is not responding to the browser. i have tried Internet explorer also with out luck. Does any one have any suggestions. the code is bellow.

/* Project 60 - Build a remote Monitoring Station
*
*/

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

IPAddress ip(192,168,0,69); //Replace this with your projects ip address
byte mac = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
EthernetServer server(80);

void setup() {
// Start the Ethernet connection and server
Ethernet.begin(mac, ip);
server.begin();
Serial.begin(9600);
delay(1000);
Serial.println(“Arduino is Ready”);
for (int z=0; z<10; z++)
{
pinMode(z, INPUT); //set digital pins 0 to 9 to inputs
}
}

void loop()
{
// listen for incoming clients (incoming web page request connections)
EthernetClient client = server.available();
if (client) {
// an http request ends with blank line
boolean currentLineIsBlank = true;
while (client.connected()){
if (client.available()){
Serial.println(“connected 2”);
char c = client.read();
if (c == ‘\n’ && currentLineIsBlank){
client.println(“HTTP/1.1 200 OK”);
Serial.println(“HTTP/1.1 200 OK”);
client.println(“Content-Type: text/html”);
client.println(“Connection: close”);
client.println();
client.println("");
client.println("");
// add a mets refresh tag, so the browser pull again every 5 sec:
client.println("<meta http-equiv=“refresh” content=“5>”);
// output the value of each input pin into the web page
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(”
");
}
// output the value of the digital pins 0 to 9 into the web page
for (int digitalChannel = 0; digitalChannel < 10; digitalChannel++){
boolean pinStatus = digitalRead(digitalChannel);
client.print(“digital pin “);
client.print(digitalChannel);
client.print(” is “);
client.print(pinStatus);
client.println(”
“);
}
client.println(””);
break;
}
if (c == ‘\n’){
// you are 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();

}

}

Change your code a little. You should have shown a bunch of "connected 2" lines on your serial monitor, one for every character in the client request, and that would be a bunch if you are using Chrome.

    while (client.connected()){
// change this from 'if' to 'while'
      while (client.available()){
// remove this Serial.println
        // Serial.println("connected 2");

Thank you

I found the problem. I was missing the \ after content=

client.println("<meta http-equiv=“refresh” content=“5”>");

it is working now.

what benefit will changing if to while give ?

Server response speed. The "if" to "while" change will give you only a modest speed improvement. The removal of the Seral.println will give you a dramatic speed increase.

Thank You