I'm successfully connecting my server but I can't handle the response data. esp8266.find("+PID,") doesn't work. My loop code is below:
void loop() {
String cmd = "AT+CIPSTART="TCP",""; //make this command: AT+CPISTART="TCP","192.168.88.35",80
cmd += DST_IP;
cmd += "",80rn";
esp8266.print(cmd);
//wait a little while for 'Linked'
delay(3000);
//This is our HTTP GET Request change to the page and server you want to load.
cmd = "GET /~atolye/wifiModule.php?id=123 HTTP/1.0rn";
cmd += "Host: 159.122.115.70rnrn";
esp8266.print("AT+CIPSEND=63rn");
if(esp8266.find(">")) {
//Send our http GET request
Serial.println("SENDING THE REQUEST");
esp8266.print(cmd);
if(esp8266.find("+IPD,")) {
Serial.println("rnIPD FOUND");
if(esp8266.find(""1")) {
int value = esp8266.read()-48;
Serial.println("rnVALUE FOUND");
Serial.println(value);
esp8266.println(value);
}
} else {
Serial.println("rn!! IPD NOT FOUND");
}
}
else {
Serial.println("rnERROR > DOESN'T EXIST");
//Something didn't work...
esp8266.print("AT+CIPCLOSErn");
}
}
And this is the output: As you can notice, IPD NOT FOUND executes before RESPONSE arrives. What should I do to catch that data? Thanks in advance.
AT+CIPSTART="TCP","159.122.115.70",80
CONNECT
OK
SENDING THE REQUEST
!! IPD NOT FOUND
START="TCP","159.122.115.70",80
busy s...
Recv 103 bytes
SEND OK
+IPD,205:HTTP/1.1 200 OK
Date: Thu, 16 Jun 2016 08:33:19 GMT
Server: Apache/2.4.16 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4
X-Powered-By: PHP/5.5.30
Connection: close
Content-Type: application/json
"12"CLOSED
Aucun commentaire:
Enregistrer un commentaire