简体   繁体   中英

How to send serial data (URL) to the sim800l for long strings

I try to send a post request with sim800l but, when I send a long string i have a strange problem

the ouput of my Serial console

AT+SAPBR=3,1,"APN","free"
OK

AT+SAPBR=1,1
OK

AT+SAPBR=2,1

+SAPBR: 1,1,"10.124.170.82"
OK

AT+HTTPINIT
OK

AT+HTTPPARA="CID",1
OK

AT+HTTPPARA="URL",","http://naviwatt.fr/api/boat/AETFC58003****/*****/time/35"
AT+HTTPPARA="URL",","http://naviwatt.fr/api/boat/AETFC58003****
AT+HTTPACTION=1

ERROR

the part where the error may be

//setup the request
String request = "AT+HTTPPARA=\"URL\",\",\"http://naviwatt.fr/api/boat/" + Id + "/" + Password + "/time/" + counter + "\"";

Serial.println("" + request);

delay(200);
sim.println(request);
sleep();

and the sleep(); function

void sleep(){
  String dump;
  delay(100);
  while(!sim.available()){
    Serial.print("waiting");
    delay(200);
  }
  while(sim.available()){
     dump = sim.readString();
     Serial.println(dump);
   }
}

The Serial.println print in the console the correct String to use

But when i send this same string to the sim800l the url seems not full

Your AT+HTTPPATA command is not proper.

It should be

AT+HTTPPARA="URL","http://naviwatt.fr/api/boat/AETFC58003****/*****/time/35"

instead of

AT+HTTPPARA="URL",","http://naviwatt.fr/api/boat/AETFC58003****/*****/time/35"

their is an extra ," in your command.

Similarly you second command should be

AT+HTTPPARA="URL","http://naviwatt.fr/api/boat/AETFC58003****

instead of

AT+HTTPPARA="URL",","http://naviwatt.fr/api/boat/AETFC58003****

Your setup the request should be

String request = "AT+HTTPPARA=\"URL\",\"http://naviwatt.fr/api/boat/" + Id + "/" + Password + "/time/" + counter + "\"";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM