Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

+IPD - I found out how to get it answered immediately #23

Open
arturotramontini opened this issue Sep 4, 2019 · 0 comments
Open

+IPD - I found out how to get it answered immediately #23

arturotramontini opened this issue Sep 4, 2019 · 0 comments

Comments

@arturotramontini
Copy link

arturotramontini commented Sep 4, 2019

after the server has finished to send back to client te response,
i wait for 2 milliseconds delay
then send three times the character '+' (without any delay between them, and without any cr lf)
the wait again for 2 millisecond delay.

note:
this is indicate into some PDF for terminate also AT+CIPSEND without the length of sending message

here a little part of arduino sketch....

void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {

Serial.println("new client");

while (client.connected()) {

  if (client.available()) {

    char c = client.read();
    Serial.write(c); //echoing

    if (c == '.') {
      Serial.println("\r\n'.' received - send back 6 analog channels...");
      
      client.println();
      for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
        int sensorReading = analogRead(analogChannel);
        
        sprintf(s,"ch%02d: %4d",analogChannel,sensorReading); //local echoing
        Serial.println(s);
        
        client.print("analog input ");
        client.print(analogChannel);
        client.print(" is ");
        client.print(sensorReading);
        client.println();
      }

      //-- part added ---
      delay(2);
      client.print("+++");
      delay(2);
     //-----------
     
     break;

    }
  }
}

// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disconnected");

}
}

----------------- at client side ----------
AT+CIPSTART="TCP","192.168.43.177",80

CONNECT

OK
AT+CIPSEND=1

OK

busy s...

Recv 1 bytes

SEND OK

+IPD,2:

+IPD,13:analog input
+IPD,1:0
+IPD,4: is
+IPD,3:811
+IPD,2:

+IPD,13:analog input
+IPD,1:1
+IPD,4: is
+IPD,3:258
+IPD,2:

+IPD,13:analog input
+IPD,1:2
+IPD,4: is
+IPD,2:88
+IPD,2:

+IPD,13:analog input
+IPD,1:3
+IPD,4: is
+IPD,2:37
+IPD,2:

+IPD,13:analog input
+IPD,1:4
+IPD,4: is
+IPD,2:61
+IPD,2:

+IPD,13:analog input
+IPD,1:5
+IPD,4: is
+IPD,2:18
+IPD,2:

+IPD,3:+++

---- NOTE -----

the "+IPD..." response is made when AT+CIPMODE=0
when AT+CIPMODE=1 the response is only the text (without +IPD)

.
.
.
at client side:

AT+CIPMODE=1

OK
AT+CIPSEND

OK

analog input 0 is 823
analog input 1 is 339
analog input 2 is 210
analog input 3 is 199
analog input 4 is 229
analog input 5 is 169
+++AT

OK

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant