HTTPREAD missing characters with Arduino and SIM900

一世执手 提交于 2019-12-24 17:48:48

问题


I am using a SIM900 module with my Arduino and it is missing characters although it is returning the right number of characters expected. I have ERROR on AT+SAPBR=1,1 and AT+HTTPINIT so I am not sure if this is the reason for it. Im not sure how to fix these issues either.

AT+CGATT?

+CGATT: 1

OK
AT+CGATT=1

OK
AT+SAPBR=3,1,"CONTYPE","GPRS"

OK
AT+SAPBR=3,1,"APN","mobile.o2.co.uk"

OK
AT+SAPBR=1,1

ERROR
AT+HTTPINIT

ERROR
AT+HTTPPARA="URL","http://www.xxxxxxxxxxx.com/temp/"

OK
AT+HTTPACTION=0

OK

+HTTPACTION:1,200,56
AT+HTTPREAD

+HTTPREAD:56
{"type":"dOK

My function that reads characters as they come in:

void whileAvailable() {
  char data;
  while (SIM900.available()) {
    data=SIM900.read();
    if (data>0) Serial.print(data);
  }
}

I believe the function is reading characters fine however I am not sure why it is failing the find the rest of the characters


回答1:


This is due to Serial buffer overflow of arduino uno or mega you use. Increase the buffer size so that they will accommodate more bytes; and those data can be displayed.



来源:https://stackoverflow.com/questions/33838165/httpread-missing-characters-with-arduino-and-sim900

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!