I'm working with AVR mcu and I'm communicating with a wifi module (ESP8266) via uart that has the ability to act as a server, hence to send and receive messages from other clients.
I encounterd a problem that has difficulty solving.
The situation is that I want to send a message from the MCU to the outside world (other clients) via a WIFI module.
For that, I need to send first this command :
AT+CIPSEND=<client id>,<length of the string I want to send>
then I need to wait for a "OK" response from the wifi module and just after that I can send my message and also wait for "SEND OK" message as a response.
So in conclusion I need 4 steps :
1. send a request to some client
2. wait for OK response
3. send the wanted message
4. get the SEND OK response
I have a function that makes me this but I don't want it to be waiting for the OK response / SEND OK (in a while loop for example) cause it causes me a delay.
What can I do in order to minimize delay the OK ?
I would be glad to hear tips