简体   繁体   English

如何将串行数据(URL)发送到sim800l以获取长字符串

[英]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 我尝试用sim800l发送一个帖子请求但是,当我发送一个长字符串时,我有一个奇怪的问题

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 Serial.println在控制台中打印要使用的正确String

But when i send this same string to the sim800l the url seems not full 但是,当我将相同的字符串发送到sim800l时,网址似乎不满

Your AT+HTTPPATA command is not proper. 您的AT + HTTPPATA命令不正确。

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 + "\"";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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