Post a new topicPost a reply Page 1 of 1   [ 3 posts ]
Author Message
 Post subject: 3G+GPS shield SMS EXAMPLE
PostPosted: Thu Sep 27, 2012 12:43 pm 

Joined: Tue Sep 25, 2012 10:49 am
Posts: 9
Hi.
I try the sms example with some problems...

If i try to send directtly AT+CPMS="SM","SM","SM" from terminal it's ok, it show 7,20,7,20...
If i read a sms with AT+CMGR=2 it response with the message body...

When i try with arduino in ard mode in the Monitor i see 325 Message and when read a message with CMGR it stop.....what is the problem??


Thanks!!


Top
 Profile  
 
 Post subject: Re: 3G+GPS shield SMS EXAMPLE
PostPosted: Fri Sep 28, 2012 6:53 am 

Joined: Tue Sep 25, 2012 10:49 am
Posts: 9
I try some expermeriment with the code....the problem of the stop is when i not print the output...


Code:
  Serial.println("AT+CPMS=\"SM\",\"SM\",\"SM\"");
  Serial.flush();
  for (x=0;x< 255;x++){           
    data[x]='\0';                                       
  }

  x=0;
  do{
      while(Serial.available()==0);
      data[x]=Serial.read(); 
      [color=#FF0000]Serial.println(data[x]); [/color] //with this line work.....           
      x++;       
  }while(!(data[x-1]=='K'&&data[x-2]=='O'));


I don't understand why???


Top
 Profile  
 
 Post subject: Re: 3G+GPS shield SMS EXAMPLE
PostPosted: Fri Sep 28, 2012 7:18 am 

Joined: Mon Sep 28, 2009 11:06 am
Posts: 2207
Hello valerioweb:

The problem is fixed changing this line of code
Code:
n_sms=((data[32]-0x30)*10)+(data[33]-0x30);   


by this others

Code:
        x=0;
        do{
            x++;
        }while (data[x] != ' ');

        x++;
        n_sms=0;
        do{
            n_sms*=10;
            n_sms=n_sms + (data[x]-0x30);
            x++;
        }while (data[x] != ',');


The code stops readin the SMS because there isn't a SMS in the index 325.

Regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 3 posts ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use