UNLINK error when ESP receives data from server
Posted: Thu Jul 23, 2015 5:24 pm
I'm using ESP8266 with arduino, and I'm getting Unlink error when server sends data to ESP.
This case works:
setup () {
ESP -> Server - connect to server
}
loop() {
ESP -> Server - Send data to server
ESP <=> await an answer
ESP <- Server - Server send an answer back
Arduino read the answer of ESPserial
}
Everything works fine! But the outlined case below is NOT working.
setup () {
ESP -> Server - connect to server
}
timeToSend() {
ESP -> Server - Send data to server
ESP <=> await an answer
ESP <- Server - Server send an answer back
}
loop() {
if (canSend) {
timeToSend();
}
check (ESPserial->available()) {// if there is data in this connection from time to time (1 sec)
readESPData();
}
}
When the server send data to ESP (without ESP send data to server first), ESPserial->available() detect that data has arrived, but when I'm gonna to read it, ESP returns UNLINK, and everything gets bad.
Why can't ESP receive any data in any time? It works only when ESP send data first and want to read an answer...
Marcio
This case works:
setup () {
ESP -> Server - connect to server
}
loop() {
ESP -> Server - Send data to server
ESP <=> await an answer
ESP <- Server - Server send an answer back
Arduino read the answer of ESPserial
}
Everything works fine! But the outlined case below is NOT working.
setup () {
ESP -> Server - connect to server
}
timeToSend() {
ESP -> Server - Send data to server
ESP <=> await an answer
ESP <- Server - Server send an answer back
}
loop() {
if (canSend) {
timeToSend();
}
check (ESPserial->available()) {// if there is data in this connection from time to time (1 sec)
readESPData();
}
}
When the server send data to ESP (without ESP send data to server first), ESPserial->available() detect that data has arrived, but when I'm gonna to read it, ESP returns UNLINK, and everything gets bad.
Why can't ESP receive any data in any time? It works only when ESP send data first and want to read an answer...
Marcio