7 years, 8 months ago.

Display OK on Coolterm after AT+CIPSEND

I want to send "Hello" after using AT+CIPSEND but on Coolterm get "ERROR", what would be best approach to get OK for this? Below is some of code I have used for this.

<code> serial.printf("\n-- Send data --\r\n"); strcpy(snd, "AT+CIPSEND=4, 5"); send message strcpy(snd, "Hello\r\n"); SendCMD(); timeout=5; getReply(); serial.printf(buf);

This function sends the command string to the ESP8266 void SendCMD() { esp.printf("%s", snd); }

This function establishes the space for the received string, starts a timer so that if things get stuck, the app won't hang. void getReply() {

memset(buf, '\0', sizeof(buf)); t.start(); ended=0; count=0; while(!ended) { if(esp.readable()) { buf[count] = esp.getc(); count++; } if(t.read() > timeout) { ended = 1; t.stop(); t.reset(); } }

}

</code>

Be the first to answer this question.