Go Down

Topic: GSM , Replay to SMS problem ? (Read 2579 times) previous topic - next topic

May 03, 2013, 06:00 pm Last Edit: May 06, 2013, 12:19 am by mohammadKTaha Reason: 1
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: [Select]
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: [Select]

#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);

}


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy