Pages: [1]   Go Down
Author Topic: GSM , Replay to SMS problem ?  (Read 1707 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 SM100B GSM , every thing is working perfectly except when i want to send an sms after receive an sms
"replay to message ", i get this

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

i know that CME ERROR: 4    means Operation not supported .
but what i can do to prevent it ?

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 05, 2013, 05:19:22 pm by mohammadKTaha » Logged

Pages: [1]   Go Up
Jump to: