One Wire DS18B20 on webPage

Hello everybody!
I try since now many days to display the temperature of my 2 composants (One wire DS18B20) on a web page.
I succeed to have the result on the serial monitor, but when I do that my web page is not accessible…
When i remove 2 lines, my web page is accessible, but of course nothing in the serial monitor…
The 2 lines are:
//sensors.requestTemperatures(); // I have to remove this line to have my web page!
//printTemperature(insideThermometer);// I have to remove this line to have my web page!

I can’t understand why I can’t have my web page available and the result in the serial monitor.
Please help…
This is my code:

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

// Data wire is plugged into pin 10 on the Arduino
#define ONE_WIRE_BUS 10

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

// Assign the addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html

DeviceAddress insideThermometer = { 0x28, 0x97, 0xCA, 0x29, 0x05, 0x00, 0x00, 0x63 };//=28 97 CA 29 5 0 0 63
DeviceAddress outsideThermometer = { 0x28, 0x85, 0xF6, 0x3F, 0x05, 0x00, 0x00, 0xC2 };//28 85 F6 3F 5 0 0 C2
//DeviceAddress dogHouseThermometer = { 0x28, 0x59, 0xBE, 0xDF, 0x02, 0x00, 0x00, 0x9F };
byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip = { 192, 168, 0, 177 }; // ip in lan
byte gateway = { 192, 168, 0, 254 }; // internet access via router
byte subnet = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port

//////////////////////

void setup(){
//----------------------------------SetUp One Wire-------------------------------
// start serial port
Serial.begin(9600);
// Start up the library
sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution(insideThermometer, 10);
sensors.setResolution(outsideThermometer, 10);
//sensors.setResolution(dogHouseThermometer, 10);
//----------------------------------Fin SetUp One Wire-------------------------------

//start Ethernet
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
Serial.begin(9600);
Serial.println(“server LED test 1.0”); // so I can keep track of what is loaded

}

void loop()

{
delay (1000);
(“Getting temperatures…\n\r”);
//sensors.requestTemperatures(); // I have to remove this line to have my web page!

Serial.print(“Inside temperature is: “);
//printTemperature(insideThermometer);// I have to remove this line to have my web page!
Serial.print(”\n\r”);
// Serial.print(“Outside temperature is: “);
//printTemperature(outsideThermometer);
//Serial.print(”\n\r”);
//Serial.print(“Dog House temperature is: “);
//printTemperature(dogHouseThermometer);
//Serial.print(”\n\r\n\r”);

{
boolean currentLineIsBlank;
// Create a client connection
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();

//read char by char HTTP request

//if HTTP request has ended
if (c == ‘\n’) {

client.println(“HTTP/1.1 200 OK”); //send new page
client.println(“Content-Type: text/html”);
client.println();

client.println("");
client.println("");
client.println("");
client.println("");
client.println("");
// Titre de la page Web
client.println(“Arduino ATMega 2560”);
client.println("");
client.println("");

client.println(“

Arduino ATMega 2560

”);
client.println("
");
client.println("
");

client.println();
//Envoi des données
client.println("
“);client.println(”
");

client.print(“

This is for test

”);
client.print("");
client.println("
");

//stopping client
client.stop();
}
}
}
}
}
}

void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
Serial.print(“Error getting temperature”);
} else {
Serial.print("C: “);
Serial.print(tempC);
// Serial.print(” F: ");
//Serial.print(DallasTemperature::toFahrenheit(tempC));
}
}

Patrick

Change your pin sensor from 10 to another. The Ethernet card uses pin 10, it is the chip select pin

Have a look at this excellent tutorial: Tweaking4All.com - Arduino Ethernet - Pulling data from your Arduino

Or if you want to store the readings in a MySQL database, this one: http://www.tweaking4all.com/hardware/arduino/arduino-ethernet-data-push/

GREAT!!!!!
Congratulations et thank you Hugo: The problem was the pin 10!!!
I will never have find that alone....
Thank you also Thinkpad: your tuto can help me.

Patrick

 ("Getting temperatures...\n\r");

What is this supposed to do?

Sorry, this is a mistake...

The code is:
Serial.print("Getting temperatures...\n\r");