if(client) and if(client.connected()) return false - TemperatureWebPanel problem

Hey y'all,

I'm basically testing out the TemperatureWebPanel example to learn how to get data onto an html page. However, I followed the instructions carefully, and I can get as far as getting the html page loaded onto my browser from the SD card, but the html webpage will not update. I am pretty sure this is because the code never gets past if(client), which returns false. I already tried changing it to if(client.connected()), but that also returns false.

Is there anything I'm missing that I need to do to get the client up and running properly? Should the client be working fine once I type YunClient client = server.accept()?

Thanks

Please, read How to use this forum (especially the #7).

PLEASE post your whole code under Code Brackets.

As this is the Programming Questions forum, posting your program is essential.

Thank you for the tip.

Here is my code:

/*
  variation of the built-in Arduino program, Temperature webpanel

 http://www.arduino.cc/en/Tutorial/TemperatureWebPanel

 */

#include <Bridge.h>
#include <YunServer.h>
#include <YunClient.h>
#include <Console.h>

// Listen on default port 5555, the webserver on the Yún
// will forward there all the HTTP requests for us.
YunServer server;
String startString;
long hits = 0;

void setup() {
  Serial.begin(9600);

  // Bridge startup
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
  Bridge.begin();
  Console.begin();
  while(!Console);

  digitalWrite(13, HIGH);

  // using A0 and A2 as vcc and gnd for the TMP36 sensor:
  pinMode(A1, INPUT);
  //pinMode(A2, OUTPUT);
  //digitalWrite(A0, HIGH);
  //digitalWrite(A2, LOW);

  // Listen for incoming connection only from localhost
  // (no one from the external network could connect)
  server.listenOnLocalhost();
  server.begin();



  // get the time that this sketch started:
  Process startTime;
  startTime.runShellCommand("date");
  while (startTime.available()) {
    char c = startTime.read();
    startString += c;
  }
}

void loop() {
  // Get clients coming from server
  YunClient client = server.accept();

  // There is a new client?

  if (client.connected()) { Console.print("We are connected to the client.");
    // read the command
    String command = client.readString();
    command.trim();        //kill whitespace
    Console.print(command);
    // is "temperature" command?
    if (0==0){//command == "temperature") {

      // get the time from the server:
      Process time;
      time.runShellCommand("date");
      String timeString = "";
      while (time.available()) {
        char c = time.read();
        timeString += c;
      }
      Console.print(timeString);
      int sensorValue = analogRead(A1);
      // convert the reading to millivolts:
      float voltage = sensorValue * (5000.0f / 1024.0f);
      // convert the millivolts to temperature celsius:
      float temperature = (voltage - 500.0f) / 10.0f;
      // print the temperature:
      client.print("Current time on the Y&uacute;n: ");
      client.println(timeString);
      client.print("
Current temperature: ");
      client.print(sensorValue);//temperature);
      client.print(" &deg;C");
      client.print("
This sketch has been running since ");
      client.print(startString);
      client.print("
Hits so far: ");
      client.print(hits);
    }

    // Close connection and free resources.
    client.stop();
    hits++;
  }

  delay(50); // Poll every 50ms
}