Open
Description
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
Metadata
Metadata
Assignees
Labels
No labels