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