Go Down

Topic: Authorized SMS using GSM SHIELD (Read 616 times) previous topic - next topic

khizon18

Hi. I am new in GSM shield.

Using sim900 I successfully connected my Arduino Uno to pin 4 and pin 5 with library BETA_GSM_GPRS_GPS_IDE100_v304..
For some reason the code authorization doesn't really do anything even though I have 1 phone-book save in the SIMCARD the other SMS that is not save in the phone book is also printing..


Code: [Select]
#include "SIM900.h"
#include "sms.h"
#include <SoftwareSerial.h>
SMSGSM sms;
boolean started=false;
char phone_num[20]; // array for the phone number string
char sms_text[100]; // array for the SMS text string






void setup()
{
 //Serial connection.
 
 Serial.begin(9600);
 Serial.println("GSM Shield testing.");
 //Start configuration of shield with baudrate.
 //For http uses is raccomanded to use 4800 or slower.
 if (gsm.begin(2400)){
   Serial.println("\nstatus=READY");
   started=true;  
 }
 else Serial.println("\nstatus=IDLE");
 
 if(started){
   //Enable this two lines if you want to send an SMS.
   //if (sms.SendSMS("3471234567", "Arduino SMS"))
     //Serial.println("\nSMS sent OK");
 }

};



void loop() {
char  position = sms.IsSMSPresent(SMS_UNREAD);
char  position2 = sms.IsSMSPresent(SMS_READ);
 if (position) {  
   
 if(sms.GetAuthorizedSMS(position, phone_num, sms_text, 100, 1, 10))
   {
     Serial.println(phone_num);
     Serial.println(sms_text);
       }
    else {
    sms.DeleteSMS(1);
    Serial.println("deleted");
    }
 
   }
   
  if (position2) {
   sms.DeleteSMS(position2);
   
   }
 delay (100);
};
 

 
 



What I am really wanted to do is print only the SMS coming from my phonebook. Sorry for my bad English. I hope you'll answer this soon. I really need it.

fbriggs4

What is the output you are getting with the code you posted?

Go Up