HTTPREAD missing characters with Arduino and SIM90

2019-08-10 06:43发布

问题:

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.



标签: c arduino sim900