Problem with WebServer

Hi I’m trying to make my sketch working.
I tested the WebServer code and this is working well.
I tested the DS18x20 reading code and this is working well.
After combining both codes the webserver is not working, it seems that after activate the function call “readvalue(addr)” the webserver doesn’t work.

WebServer_Show_Temp_Reading_Test_23-01.ino (6.09 KB)

Please read #7 below on how to post code so it does not need to be downloaded to be read:

http://forum.arduino.cc/index.php/topic,148850.0.html

Hello, I'm new so tank you for your response ...

My problem is that after the function call "readvalue(addr)" the "if(client)" never will become true. When I delete the function call the web server works okay.

void loop() {
  byte addr[8];         //address of devices on the onewire bus  
  int SensNum = 0;      //sensor number
  int SensNum_Max = 0;  //number of sensors detectedon the bus
  float TempRead[5];    //array with temperature readings

  // search sensor address on onewire bus
  while (ds.search(addr)) {
    SensNum++;
    TempRead[SensNum] = readvalue(addr);
    Serial.print("Temperatuur sensor ");
    Serial.print(SensNum);
    Serial.print(" is ");
    Serial.println(TempRead[SensNum],1);
  }
  Serial.print("Found ");
  Serial.print(SensNum);
  Serial.println(" sensor(s).");
  ds.reset_search();
  SensNum_Max = SensNum;
  delay(2500);
   
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");
OneWire  ds(10);  // on pin 10 (a 4.7K resistor is necessary)

Look at the product reference page for your Arduino.

See which pins are used for SPI. See which pins can NOT be used for other purposes.

Hello Thank you for your response,

The function readvalue(addr) is working well. Only when I combine the code with the WebServer code the sketch is not working after calling the function readvalue(addr). So when calling the function:

while (ds.search(addr)) {
    TempRead[SensNum] = readvalue(addr);
  }

The WebServer code will never response to the "server.available()"

  // listen for incoming clients
  EthernetClient client = server.available();

Have you gotten the sensor off of pin 10? If not, you are wasting our time.

I'm sorry that I didn't write that I'm using a Arduino MEGA2560 and an Ethernet Shield W5100. I have connected my sensors OneWire bus to pin 10.

Hi Paul,
Your remark has helped me to solve my problem as indeed pin 10 is been used for W5100
Thank you for your help
Mike