I am trying to receive an SMS on my arduino and print it out to the serial monitor. I am using the A9G gsm/gps module for doing that. Here is the code for it
#include <SoftwareSerial.h>
//Create software serial object to communicate with A6
SoftwareSerial mySerial(10, 11); //A6 Tx & Rx is connected to Arduino #3 & #2
void setup()
{
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(115200);
//Begin serial communication with Arduino and A6
mySerial.begin(115200);
Serial.println("Initializing...");
delay(1000);
mySerial.println("AT"); //Once the handshake test is successful, it will back to OK
updateSerial();
mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
updateSerial();
mySerial.println("AT+CNMI=2,2,0,0,0"); // Decides how newly arrived SMS messages should be handled
updateSerial();
}
void loop()
{
updateSerial();
}
void updateSerial()
{
delay(500);
while (Serial.available())
{
mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(mySerial.available())
{
Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
}
}
The code works and I get a response but the response does not include the body of the message. This is the response I got after sending "hello" to it;
CIEV: "MESSAGE",1
+CMT: "+233201729573",,"2021/06/18,12:20:03
As you can see it rightly sends me a notification but it does not include the "hello" which is the actual message I want to receive. Can anyone help me out?