0

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
dda
1,5951 gold badge12 silver badges17 bronze badges
asked Jul 28, 2016 at 7:42
0

1 Answer 1

0

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.

answered Aug 3, 2016 at 5:56
2
  • Please note that you may want to check/handle the responses on these commands. Commented Dec 1, 2016 at 19:54
  • Please, accept your own answer to close this question. Commented Oct 30, 2017 at 19:11

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.