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!
There are lots of different shields. Can you provide a link to the one you have?
here is the link..
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..