I have added my Arduino code for reading messages from GSM SIM900A using Arduino. But the output is showing something different. Please help me.
#define SERIAL_BUFFER_SIZE 256
char msg;
void setup() {
Serial.begin(9600); // Setting the baud rate of GSM Module
delay(60000);
Serial.println("AT");
delay(1000);
Serial.println("AT+CREG=1");
delay(1000);
Serial.println("AT+CMGF=1"); // set SMS mode to text
delay(1000);
Serial.println("AT+CMGR=\"ALL\"");
delay(1000);
Serial.println("AT+CMGR=\"ALL\"");
delay(1000);
while ( Serial.available() > 0) Serial.read(); // removing serial buffer values
Serial.println("AT+CMGR=1");
delay(2000);
}
void loop() {
while (Serial.available() > 0) {
msg = serial.read()
Serial.print(msg);
}
}
This is the output:
+CMGR: "REC READ","+91xxxxxxxxxx","","16/07
1 Answer 1
Hello Guys i found the issue. Serial.read() function reads only 62bytes. After i have update the serial buffer size in library file C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\HardwareSerial.H ... It shows the messages which is stored in serial buffer.
-
Please note that you may want to check/handle the responses on these commands.aaa– aaa2016年12月01日 19:54:30 +00:00Commented Dec 1, 2016 at 19:54
-
Please, accept your own answer to close this question.user31481– user314812017年10月30日 19:11:05 +00:00Commented Oct 30, 2017 at 19:11