0

I am using Arduino Uno along with GSM 900A Module to send SMS to my phone. This is the code

 #include <SoftwareSerial.h>

SoftwareSerial mySerial(9, 10);

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=\"+91xxxxxxxxxx\"\r"); // Replace x with mobile number 91 is country code
     delay(1000);
     mySerial.println("Hi");// 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());
}

This is the output I get :

enter image description here

The GSM Module is showing Blue Light for Status and Yellow Light is stable for network meaning that the network is good for the module. Also, the TX light on Uno glows continuously but the RX light never glows

  • 1
    Your code is sending "Hi", but your output is showing you sending "HEI DPV,THIS IS....". Please show your actual code, not some other code. It needs to be exactly what produced the output, or it is meaningless. – Majenko Feb 25 at 22:57

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.