Problem with Arduino GSM shield mySerial for AT commands

Hello,

I am working on interfacing the arduino gsm shield with the Quectel m10 for my application. I am sending the m10 AT commands through the software serial library and this works fine when its embedded into my code. It doesn’t seem to work when I try to send AT commands through the serial monitor and read the response. It was previously working but now its just spitting out gibberish. Here is my code:

}

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2,3);

char inChar = 0;

void setup()  
{
  Serial.begin(9600);
  Serial.println("Device ready");
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
}

void loop() // run over and over
{
  if (mySerial.available()){
    inChar = mySerial.read();
    Serial.write(inChar);
    delay(20);
    }
    
  if (Serial.available()>0){
    mySerial.write(Serial.read());
  }
}

It gives me something like this for anything I type in:
Device ready
DeD?ÿDeD±T?Wk?ready

Thanks for the help,
Micah

Micah_kurtz:

    delay(20);

What's the delay() for? Does getting rid of it fix things?