Pages: [1]   Go Down
Author Topic: Authorized SMS using GSM SHIELD  (Read 555 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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.
Logged

Virginia, USA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 93
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: