atc_command() wait until get correct answer
HI,
I'm trying to set workflow with ESP8266 to send data to TCP server over AT commands.
the atc_command() not wait to correct answer and i need to wait until get "CONNECT" and later get ">" sign to able send my string.
it is not send the data after ">" sign, also not halt until correct answer received.
see some my code below,
uint8_t espSendDataTCP(char *APIkey, int Field_num, uint16_t value)
{
char localBuffer[100] = {0};
char localBuffer2[30] = {0};
sprintf (localBuffer, "GET /update?api_key=%s&field%d=%u\r\n", APIkey, Field_num, value);
sprintf (localBuffer2, "AT+CIPSEND=%d\r\n", strlen(localBuffer));
if(atc_command(&atc, localBuffer2, 5000, NULL, 0 ,1, "\r\nCONNECT")!= 1)
{
printf("ERROR: ESP01 cannot set TCP connection \r\n");
toggleGreenLed(6);
return -1;
}
HAL_Delay(5000);
if(atc_command(&atc, localBuffer, 1000, NULL, 0 ,1, "\r\n>" )!= 1)
{
printf("ERROR: ESP01 cannot set TCP connection \r\n");
toggleGreenLed(6);
return -1;
}
return 1;
}
BR, ElkanaM
Hi. please enable debug to watch what happen. maybe got some error message from ESP
I used this library in GSM and it works fine.
I used this library in GSM and it works fine.
I will follow this library to see how it works. it will good to be better documentation to explain the prepose and behavior of each function.
Hi. please enable debug to watch what happen. maybe got some error message from ESP
in debug mode, I saw it is all OK but on Logic analyzer seems like have missing answers and the function return 1. what I dont understand its, if the at_command() set to search lets say two answers, the function will run till find both answers or timeout set? if so, it is good for me, from I need some hard result to verify that some answer received or not.
Thanks, ElkanaM