Hello,
Try to receive sms using AT commands with the next code and sending them via serial monitor (configured CR / NL).
#include <SoftwareSerial.h>
#include <string.h>
char incoming_char = 0;
SoftwareSerial cell(2, 3);
void setup()
{
Serial.begin(9600);
cell.begin(9600);
Serial.print("Starting modem communication...");
delay(12000);
Serial.print("OK\nIntroduce your AT commands:\n");
}
void loop()
{
if(cell.available() > 0)
{
incoming_char=cell.read();
if((incoming_char >= ' ') && (incoming_char <= 'z'))
Serial.print(incoming_char);
else
{
Serial.print("%");
Serial.print((int)incoming_char);
Serial.print("%");
if(incoming_char==10)
Serial.println();
}
}
if(Serial.available() > 0)
{
incoming_char = Serial.read();
cell.print(incoming_char);
}
}
The AT commands for receiving SMS are:
ATE1 --> Set echo ON
AT+CMGF=1 --> Establishes text mode in modem
AT+CMGL="REC UNREAD",1 --> Checks if exists unread SMS. Return OK if not exist any SMS, in other case returns a list with them (the first number of each of them are the index of each of them).
AT+CMGR=[sms_index],0 --> Read SMS with index sms_index from modem memory (ej: AT+CMGR=1,0).
AT+CMGD=[sms_index] --> Delete SMS with index sms_index from modem memory (ej: AT+CMGD=1).
The problem can be attached with your local operator. Are you using the SIM that came with the shield?.