Problems to read messages content with A6 module

Hi, i’m having troubles with the A6 module, my objective was to recieve and compare SMS from the module.

#include <SoftwareSerial.h>
SoftwareSerial Cereal(2, 3);
char inData[200]; 
char inChar=-1; 
byte index = 0; 
String word ="";

void setup() {
Cereal.begin(9600);
Serial.begin(9600);
}


void loop() {
  if (Cereal.available() > 0){
        if(index < 99){
            inChar = Cereal.read();
            inData[index] = inChar;
            index++;
            inData[index] = '\0';
        }
  else{
    for (int i=0;i<99;i++){
      inData[i]='\0';
      index=0;
    }
  }
  Serial.println("Check");
  word = inData;
  print();
}
}

void print(){
   Serial.write("Chain: ");
    Serial.write(inData);
    Serial.write("\n");
    Serial.write("Word: ");
    Serial.print(word);
    Serial.write("\n");
}

This was supposed to be a test code for reading content due the serial port, but only recieved the header of the message but not the content.

+CIEV: "MESSAGE",1

+CMT: "**************",,"2020/12/09,17:42:5

I also used USB direct connection to the A6 module, and i can read it perfectly.
Glad you help me :).

What is an "A6 module" ?

...R

I´m sorry, i didin´t explain very well. The A6 is a GSM/GPRS module, similar to SIM800L. The attached sketch was made to test the sending and receiving of SMS. all good if I send the SMS, but at the reception I have the problem explained above.

#include "SoftwareSerial.h"
SoftwareSerial mySerial(2, 3);
String palabra = "";
int barrera = 5;           // Pin del ingreso de disparo

void setup()
{
  pinMode(barrera,INPUT_PULLUP);
  mySerial.begin(9600);
  Serial.begin(9600);
  mySerial.println("AT+CMGF=1");          // configuro Envío SMS
  updateSerial()
  mySerial.println("AT+CNMI=1,2,0,0,0");  // configuro como Recibir SMS en port serial
  updateSerial()
  delay(1000);
  }

void loop()
{
  updateSerial();
}

void updateSerial()
{
  delay(100);
  if (digitalRead (barrera) == LOW) {
        sendSMS();
      }
  
  while(mySerial.available())
  {
    (palabra = mySerial.readString());    //Ingreso el texto a el string palabra
    Serial.write(mySerial.read());        //Reenvío al serial lo recibido del módulo
    Serial.print(palabra);                //muestro lo que guarda la variable palabra
  }
}

void sendSMS(){
  mySerial.println("AT+CMGF=1");
  delay(500);
  mySerial.println("AT+CMGS=xxx531xyxy);
  delay(500);
  mySerial.print("Hola Mundo");
  delay(500);
  mySerial.write(26);
}

I would use the second example in my Serial Input Basics Tutorial for receiving the data. It won't send anything to the Serial Monitor until a complete message has been received.

...R

Hi Robin2, sorry for my delay in replying. Thank you very much for your recommendation.
I can now receive the content of the messages correctly now