recieve sms sim 900

Hi I am trying to recieve SMS messages from a gsm module however I am struggling to parse the message content

I am using a software serial for the gsm module
and I plan to be able to send commands to the module
in order for this to need to be able to take the senders number and place it in a variable and take the content and place that in a variable to be used as commands to run different subroutines

I dont need to store the message only long enough to be able to store the variables and then the same message adress can be cleared for the next message

thanks in advanced guys :slight_smile:

my code is below

String recieveSMS() // the function that will be used to view incoming and recieved SMS messages with "MessageLocation" being the address on the SIM card where the desired message is stored
{
  String Sender; // 13 chars
  String Message; // message content
  
  GPRS.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS
  delay (1000); // wait 1000ms

  Message = (GPRS.read());

  String SMSRecieved = (Sender + Message);
  
  return SMSRecieved;
}
  Message = (GPRS.read());

(What's) (with) (the) (useless) (parentheses)?

Why do you need to piss away resources using a String instance to hold one character?

  String SMSRecieved = (Sender + Message);

Well, this is pretty dumb, since Sender is an empty String.

my code is below

Well, a tiny portion of it, anyway.

There are any number of incorrect assumptions that you are making. First, the name of the function implies that you KNOW that there is an SMS to receive. I see no proof that that is the case.

Second, you assume that the GPRS will have completed sending a response, and that the Arduino will have completed receiving the response, in 1 second, and that NO other data will be in the input buffer. I see no proof that either assumption is reasonable.