Pages: [1]   Go Down
Author Topic: GSM shild , Replay to sms , need help please  (Read 416 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi all ,
i am using arduino to control an  GSM SM100B  , every thing is working perfectly except when i want to send an sms after receive an sms
"replay to message ", i get this Error

Code:
O K > + C M G S : 2 5 O K + C M E E R R O R : 4

dose any one have any idea about that ?

my code :

Code:
#include <SoftwareSerial.h>  //Include the NewSoftSerial library to send serial commands to the cellular module.
    char inchar;                //Will hold the incoming character from the Serial Port.
    SoftwareSerial cell(2,3);    //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.
    char mobilenumber[] = "0597010129";  // Replace xxxxxxxx with the recipient's mobile number

    void setup() {
    //GSM
    Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
    Serial.println("Initialize GSM module serial port for communication.");                       
    cell.begin(9600);
    delay(35000); // give time for GSM module to register on network etc.
    Serial.println("delay off");
    cell.println("AT+CMGF=1"); // set SMS mode to text
    delay(200);
    cell.println("AT+CNMI=3,3,0,0"); // set module to send SMS data to serial out upon receipt
    delay(200);
    }



    void loop() {   

     if(cell.available() >0)//If a character comes in, from the cellular module
     {
     inchar=cell.read();
     Serial.println(inchar);
     if (inchar=='#'){ // OK - the start of our command

       delay(10);
       inchar=cell.read();
       Serial.println(inchar); 

         if (inchar=='a'){

           delay(10);
           Serial.println("The folowing SMS : \n");
           inchar=cell.read();
           Serial.println(inchar);

           if (inchar=='0'){ //sequance = #a0

             Serial.println("#a0 was received");

         }
         else if (inchar=='1'){//sequance = #a1

            Serial.println("#a1 was received ");
            sendSms();

         }
     }
     cell.println("AT+CMGD=1,4");// AT command to delete all msgs
     Serial.println(" delete all SMS");
      }
    }//end of  if(cell.available() >0) {...}
    }

    void sendSms(){
    //cell.println("AT+CMGF=1"); // set SMS mode to text
    cell.print("AT+CMGS=");  // now send message...
    cell.print((char)34); // ASCII equivalent of "
    cell.print(mobilenumber);
    cell.println((char)34);  // ASCII equivalent of "
    delay(500); // give the module some thinking time
    cell.print(":D hello m3alleg :D");   // our message to send
    cell.println((char)26);  // ASCII equivalent of Ctrl-Z
    delay(20000);

}

« Last Edit: May 04, 2013, 12:30:13 pm by mohammadKTaha » Logged

Offline Offline
God Member
*****
Karma: 16
Posts: 592
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

CME ERROR code 4 "Operation not supported"

Quote
When the error starts with "+CME ERROR", it means that the error is a device specific error code.

http://www.smssolutions.net/tutorials/gsm/gsmerrorcodes/
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you very much,  is that means that SM5100B GSM dose not Support replay to SMS ?
what can i do ?

the receive part alone is working perfectly and the send part alone is also working perfectly but they dos not fit together  smiley-cry
« Last Edit: May 05, 2013, 03:59:24 pm by mohammadKTaha » Logged

Offline Offline
God Member
*****
Karma: 16
Posts: 592
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry I don't know the SM5100B, but you could use a,other way to send "replies" by software :

put a flag ON when a SMS comes in, then, if the flag is set, send a SMS just as you do when you only want to send a SMS (without having received one before), and put the flag OFF .
Logged

Pages: [1]   Go Up
Jump to: