Hi guys,
I have the following code:
void antwoord()
{
for (int t=0; t <= 4; t++){
String user = String(t);
String ein = "<";
String zwei = user;
String drei = ">";
String xxx = "/";
String response = ein + zwei + drei;
String endresponse = ein + xxx + zwei + drei;
Serial.print(response);
Serial.println(endresponse);
Serial.println(http_response);
if((http_response.indexOf(response) > -1 )&&(http_response.indexOf(endresponse) > -1 )){
// We check if the <arduino></arduino> are there.
response_start = http_response.indexOf(response)+3;
// Where it begins, the 9 is the length of ' <arduino> ',
// since we dont want it to appear in the response.
response_end = http_response.indexOf(endresponse);
// Where it ends
http_response = http_response.substring(response_start,response_end);
// We keep only the response of the website
Serial.println("Website response : ");
Serial.println(http_response);
Serial.println();
delay(100);
int Plus = http_response.toInt();
int Saldo = EEPROM.read(t);
int NewSaldo = Saldo + Plus;
Serial.println("New Saldo: ");
Serial.println(NewSaldo);
Plus = 0;
Saldo = 0;
NewSaldo = 0;
http_response = 0;
}
else {
Serial.println("No response detected...");
Serial.println();
}
}
It is supposed to take the value's between and and use it to add its content to the integer Saldo. This works for the first run (t=0) but after that t=1,2,3 give me no response detected.
Not sure how this happens.