-1

Actually my main project is gas leakage detection using arduino and gsm module but I am unable to receive the alert sms ..so I am trying only gsm module program first...plzz help

OUTPUT:-
AT+CMGF=1

OK
AT+CMGS="+91*********" //In place of stars

Hie Ameera Here

ERROR

Program:-

#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11);

void setup()
{
  mySerial.begin(9600);   // Setting the baud rate of GSM Module  
  Serial.begin(9600);    // Setting the baud rate of Serial Monitor (Arduino)
  delay(100);
}

void loop()
{
  if (Serial.available()>0)
   switch(Serial.read())
  {
    case 's':
      mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
     delay(1000);  // Delay of 1 second
     mySerial.println("AT+CMGS=\"+91##########\"\r"); // Replace x with mobile number //i have replaced it with my number
     delay(1000);
     mySerial.println("Hie Ameera Here");// The SMS text you want to send
     delay(100);
     mySerial.println((char)26);// ASCII code of CTRL+Z for saying the end of sms to  the module 
      delay(1000);
      break;
    case 'r':
      mySerial.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS
      delay(1000);
      break;
  }
 if (mySerial.available()>0)
   Serial.write(mySerial.read());
}

Thanking you in advance..

  • Please check the formatting before posting, this is totaly unreadable. – MatsK Oct 12 at 14:03
  • Sorry I didn't check it before as I have joined this recently ... – Ameera Ansari Oct 12 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.