Hello. I have a problem.
I set up the Wifly Shield as a server. I sent through HTTP Requests Protocol (UDP, if I remember correctly).
The problem is that the waiting time between requests is too long.
I try to do a RC and the response time should be as fast as possible.
Do you know how to get it?
I leave the code in question…
void loop() {
Client client = server.available();
if (client) {
// an http request ends with a blank line
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (readString.length() < 14)
{
//store characters to string
readString += c; //replaces readString.append(c);
Serial.println(readString);
}
if (c == '\n') {
//if (c == '\n' && currentLineIsBlank) {
if(readString.indexOf("P0")>-1){
//led has to be turned OFF
digitalWrite(LED_DOWN_RIGHT, LOW); // set the LED OFF
} ///else
if(readString.indexOf("P1")>-1) {
//led as to be turned ON
digitalWrite(LED_DOWN_RIGHT, HIGH); // set on (5 Volts)
}
}
}
}
readString="";
}
}