Xbee API + Ethernet Shield Problem HTML communication
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 19
- Joined: Sun May 27, 2012 5:28 pm
Re: Xbee API + Ethernet Shield Problem HTML communication
Ok thanks you !I modified my code like you said me ! i'm waiting now how it behaves
-
- Posts: 19
- Joined: Sun May 27, 2012 5:28 pm
Re: Xbee API + Ethernet Shield Problem HTML communication
Unfortunetly, put reset after the client.stop() is not enough. My system works a moment, stops for a moment then restarts...
-
- Posts: 19
- Joined: Sun May 27, 2012 5:28 pm
Re: Xbee API + Ethernet Shield Problem HTML communication
I modify my code in order to put the reset as soon as the system doesn't respond but unfortunetly it is not sufficient... I don't know where is the problem now.
This my code modified :
Thanks you
This my code modified :
Code: Select all
void setup()
{
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
digitalWrite(RESET, HIGH);
pinMode(RESET, OUTPUT);
server.begin();
Serial.begin(9600);
delay(1);
//Serial.print("Starting..........");
//Serial.println();
}
void loop()
{
readpacket();
EthernetClient client = server.available();
if (client)
{
boolean currentLineIsBlank = true;
while (client.connected())
{
if (client.available())
{
char c = client.read();
if (c == '\n' && currentLineIsBlank)
{
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
client.println(v[1]);
client.println(v[2]);
client.println(v[3]);
client.println(v[4]);
client.println();
client.println(z[1]);
client.println(z[2]);
client.println(z[3]);
client.println(z[4]);
client.println(z[5]);
client.println();
client.println(y[1]);
client.println(y[2]);
client.println(y[3]);
client.println(y[4]);
client.println(y[5]);
client.println();
break;
}
if (c == '\n')
{
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();
//Serial.flush();
digitalWrite(RESET, LOW);
}
digitalWrite(RESET, LOW);
}
Please be positive and constructive with your questions and comments.