Hello
I've got a problem and I don't know how can I overcome it. I'm trying to read SMS from GSM Modem using Arduino by sending
specific AT command to it. In return, the modem sends me back the sms, however it is split by carriage returns and line feeds.
In fact, there are 2 parts of sms that I'm interested in. The format send by Modem looks like that :
-confirm, send by, data - <CR><LF>
-actual message- <CR><LF>
I'm willing to retrieve second part, the message, but don't know how. For testing I was using the code :
String rsms="";
void setup()
{
Serial.begin(9600);
Serial2.begin(9600);
}
void receive_sms()
{
Serial2.print("AT+CMGR=1\r");
if (Serial2.available()>0)
{
int l=Serial.available();
for (int i=0;i<l;i++)
{
rsms += (char)Serial.read();
}
}
Serial.println(rsms);
}
void loop()
{
receive_sms();
delay(10000);
}
As expected, it only prints out the first line send by Modem, since serial.read stops at . Adding another read right after the first also didn't help. Is there a possibility to read the second part send by modem ?
Thanks in advance for your help