lingeshbarani / gsm-shield-arduino

Automatically exported from code.google.com/p/gsm-shield-arduino
0 stars 0 forks source link

problems with the GSM_Shield lib for arduino 0022 #39

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Dear,

I'm working on a project to open a door and play some sounds, depending the sms 
message.

Since I still work in the arduino 0022 environment, I installed the original 
GSM_Shield lib. Unfortunately I experience some troubles: 
- it seems that following function does not respond.  The program always 
returns user 3 instead of user 1?
if (GETSMS_AUTH_SMS == gsm.GetAuthorizedSMS(position, phone_num, sms_text, 160, 
1, 2)) {
 user = 1
}

- next to that, I want to chance the Rx and tx pin. from pins 4-5 to pins 6-7
I tried to chance the numbers in the GSM.cpp file but than, the program doesn't 
respond anymore. I understood that I only need to chance two numbers over there?

Thanks for helping me, I really appreciate your efforts.

Ciao

Didi

My code looks like this:

    #include <GSM_Shield.h>
     GSM gsm;

    char position;
    int numdata;
    boolean started=false;
    char smsbuffer[160];
    char n[20];
    char phone_num[20];
    char sms_text[160];
    int sms_counter=0;
    int sms_positie=0;
    int user=0;
    char *p, *i,*o;

void setup() 
  {
 //output pinnen declareren
   pinMode(13,OUTPUT); 
   pinMode(12,OUTPUT); 
   digitalWrite(13, LOW);

 //Serial connection.
  Serial.begin(9600);
  Serial.println("Initialisatie GSM");
  gsm.TurnOn(9600);
  gsm.InitParam(PARAM_SET_1); 
  gsm.Echo(1);
  started=true;  

};

void loop(){

    position = gsm.IsSMSPresent(SMS_UNREAD);
     if (position) {

  sms_counter = sms_counter + 1 ; 
  sms_positie = sms_positie + 1 ; 

  if (1 == gsm.GetPhoneNumber(1, phone_num)) {
          // valid phone number on SIM pos. #1 
          // phone number string is copied to the phone_num array
          #ifdef DEBUG_PRINT
            gsm.DebugPrint("DEBUG phone number: ", 0);
            gsm.DebugPrint(phone_num, 1);
          #endif
        }
        else {
          // there is not valid phone number on the SIM pos.#1
          #ifdef DEBUG_PRINT
            gsm.DebugPrint("DEBUG there is no phone number", 1);
          #endif
        }

  Serial.print("sms_counter= ");
  Serial.println(sms_counter);
  Serial.print("sms_positie= ");
  Serial.println(sms_positie);
  Serial.println(position);

   if (GETSMS_AUTH_SMS == gsm.GetAuthorizedSMS(position, phone_num, sms_text, 160, 1, 2)) {

      user = 1;

      Serial.print("User ");
      Serial.println(user);

  }  

  else if (GETSMS_AUTH_SMS == gsm.GetAuthorizedSMS(position, phone_num, sms_text, 160, 3, 10)) {    

    user = 2;

      Serial.print("User ");
      Serial.println(user);
    }

  else {
    gsm.GetSMS(position, phone_num, sms_text,160) ;

      user = 3;
  } 

Original issue reported on code.google.com by frederic...@gmail.com on 16 Aug 2012 at 7:17

GoogleCodeExporter commented 8 years ago
when I program char position statically (eg. char position=16) It works fine. 
But When 
 position = gsm.IsSMSPresent(SMS_UNREAD);

It jumps over this line... Although position does contain a number.

Original comment by frederic...@gmail.com on 17 Aug 2012 at 8:01

GoogleCodeExporter commented 8 years ago
Sorry for the late but I was away.
For this:
- next to that, I want to chance the Rx and tx pin. from pins 4-5 to pins 6-7
I tried to chance the numbers in the GSM.cpp file but than, the program doesn't 
respond anymore. I understood that I only need to chance two numbers over there?

You did right, but unfortunately Arduino does not support each pin for 
SoftwareSerial, you should check that pin 6,7 support interrupt functions.

For the other problem, I'll check it. If you have news please post them.

Marco

Original comment by martines...@gmail.com on 31 Aug 2012 at 4:50

GoogleCodeExporter commented 8 years ago

Original comment by martines...@gmail.com on 11 Dec 2012 at 5:01

GoogleCodeExporter commented 8 years ago
This issue section is not longer supported.
Please check the support page www.gsmlib.org 

Original comment by martines...@gmail.com on 6 Jul 2013 at 11:27