GSM/GPRS Shield receive sms

Hi! I just need help on how to receive sms using the GSM/GPRS Shield. I bought my GSM/GPRS Shield in e-gizmo. Thank you very much! :slight_smile:

There are lots of different shields. Can you provide a link to the one you have?

here is the link..

http://www.e-gizmo.com/KIT/gsm%20shield.html

Reasonably standard SIM900D based shield. Lots of examples on the internet, several downloads available on that page by the look of it. What have you tried?

I've tried this code but it didn't work. It will display status=idle instead of status=ready. It will also display -1 instead of 0 if there are no messages received. I have already the gsm shield library. I don't know what's wrong.

This is the code I've searched from the internet..

#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
SMSGSM sms;
char number[20];
char message[180];
char pos;
char *p;

void setup()                      //declaring inputs and outputs
{
 Serial.begin(9600);              //initiate gizduino witha baud rate of 9600
 pinMode(7, OUTPUT);              //output for turning LED ON or OFF

 if (gsm.begin(9600))             //condition if gsm is initialized
 Serial.println("\nstatus=READY");     //displays "ready" on the serial monitor if gsm is ready
 else Serial.println("\nstatus=IDLE"); //otherwise displays "idle" on the serial monitor if gsm is not found
};

void loop()     //looping of the program
{
       pos=sms.IsSMSPresent(SMS_UNREAD);  //save to variable if there is an SMS
       Serial.println((int)pos);          //display position number (a.k.a index) of the message
       if((int)pos>0&&(int)pos<=20)       //if message from 0-20 is found
              {                   
               Serial.print("Message Received, INBOX=");  //display an output on the serial monitor
               Serial.println((int)pos);                  //display the position/index of the message
               message[0]='\0';                           //display '0' if no messages found
               sms.GetSMS((int)pos,number,message,180);   //get position/index, number of sender, and text message
               Serial.println(message);                   //display the text on serial monitor
               if(strstr(message, "ON")) digitalWrite(7,HIGH);   //if message 'ON' is received, LED is ON
               if(strstr(message, "OFF")) digitalWrite(7,LOW);   //if message 'OFF' is received, LED is OFF
               sms.DeleteSMS((int)pos);                          //after reading, delete SMS
                }
 delay(5000);                             //delay of 5seconds per loop
};

And how about some links to the libraries you are using?

Here is the link where I've downloaded the gsm shield library..

https://www.dropbox.com/s/uu1wxt6kbrgdcfk/GSMSHIELD.rar