Go Down

Topic: +cme error (Read 86 times) previous topic - next topic

vidyaasini

#include <SoftwareSerial.h>
SoftwareSerial SIM900A(10,11);
void setup()
{
  SIM900A.begin(9600);   // Setting the baud rate of GSM Module 
  Serial.begin(9600);    // Setting the baud rate of Serial Monitor (Arduino)
  Serial.println ("SIM900A Ready");
  delay(100);
  Serial.println ("Type s to send message or r to receive message");
}
void loop()
{
  if (Serial.available()>0)
   switch(Serial.read())
  {
    case 's':
      SendMessage();
      break;
    case 'r':
      RecieveMessage();
      break;
  }
 if (SIM900A.available()>0)
   Serial.write(SIM900A.read());
}
 void SendMessage()
{
  Serial.println ("Sending Message");
  SIM900A.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  delay(1000);
  Serial.println ("Set SMS Number");
  SIM900A.println("AT+CMGS=\"+60174114491\"\r"); //Mobile phone number to send message
  delay(1000);
  Serial.println ("Set SMS Content");
  SIM900A.println("Good morning, how are you doing?");// Messsage content
  delay(1000);
  Serial.println ("Finish");
  SIM900A.println((char)26);// ASCII code of CTRL+Z
  delay(1000);
  Serial.println ("Message has been sent ->SMS Selesai dikirim");
}
 void RecieveMessage()
{
  Serial.println ("SIM900A Membaca SMS");
  delay (1000);
  SIM900A.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS
  delay(1000);
  Serial.write ("Unread Message done");
 }

im using this code to receive and send msg using gsm module but i get this error +cme error how to solve this problem

Robin2

@vidyaasini, please don't hijack another person's Thread with your question.

I have suggested to the Moderator to move your Post to its own Thread.

To make it easy for people to help you please modify your post and use the code button </>
Code: [Select]
so your code looks like this and is easy to copy to a text editor. See How to use the Forum

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Coding Badly


lastchancename

#3
Feb 18, 2018, 12:43 am Last Edit: Feb 18, 2018, 12:44 am by lastchancename
When you send AT commands to the modem, it's very important to WAIT for the reply. - especially when using SMS commands.

Just ploughing messages out will reliably cause issues.

If you can see which command (using your concpsole println() ) messages, you can look deeper as to why that particular  command failed.

p.s. please use <code> tags when posting!
Experienced responders have a nose for laziness, (they were beginners once)... expecting the poster to contribute to the learning experience.

Go Up