I am trying to create a webserver using an Arduino and a MAX6675 as input (Hardware test is done without problem). My arduino board is DUE which is connected to a Ethernet Shield.
My Arduino code is attached. Can anyone tell me why it is not working and printing "disconnecting" message in serial monitor?
// give the web browser time to receive the data
delay(1);
// give the web browser time to receive the data
delay(1);
// if the server's disconnected, stop the client:
if (!client.connected()) {
I would assume the client is still connected so the disconnecting. message is never printed
in a HTTP GET I use the following
// connectLoop controls the hardware fail timeout
int connectLoop = 0;
while(client.connected())
{
while(client.available())
{
inChar = client.read();
Serial.write(inChar);
if(inChar < ' ') index=0; else data[index++]=inChar;
data[index]=0;
// set connectLoop to zero if a packet arrives
connectLoop = 0;
}
connectLoop++;
// if more than 10000 milliseconds since the last packet
if(connectLoop > 10000)
{
// then close the connection from this end.
Serial.println();
Serial.println(F("Timeout"));
client.stop();
}
// this is a delay for the connectLoop timing
delay(1);
}
First off, I would try first to make the thermocouple work alone without the Ethernet shield. You say hardware test done, did you get the correct results on your serial monitor ?
Then, I would try the Ethernet shield alone, without the thermocouple connected or anything else connected, with the web server example sketch provided in Menu> File>Example>Ethernet> WebServer. Is that what you did ?
ard_newbie:
First off, I would try first to make the thermocouple work alone without the Ethernet shield. You say hardware test done, did you get the correct results on your serial monitor ?
Then, I would try the Ethernet shield alone, without the thermocouple connected or anything else connected, with the web server example sketch provided in Menu> File>Example>Ethernet> WebServer. Is that what you did ?
Thanks But i am still confused. didn't get the response.
ard_newbie:
First off, I would try first to make the thermocouple work alone without the Ethernet shield. You say hardware test done, did you get the correct results on your serial monitor ?
Then, I would try the Ethernet shield alone, without the thermocouple connected or anything else connected, with the web server example sketch provided in Menu> File>Example>Ethernet> WebServer. Is that what you did ?
Yes both are OK. Hardware Test and Arduino WebServer Example are doing fine.