You might want to think about how your sketch is arranged. Send command to device, declare variable, see if anything on serial (the response might not have arrived yet?), print out contents of variable regardless? Wait, and then repeat, and repeat...
#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 3
SoftwareSerial mySerial(rxPin, txPin);
void setup()
{
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
mySerial.begin(9600); // setting baud to 9600
Serial.begin(9600);
}
void loop()
{
mySerial.write("AT\r\n");
char rcv;
while (mySerial.available()==0) // Sit in a loop awaiting some input
{
}
if(mySerial.available()) // Which it will be
{
rcv = mySerial.read();
Serial.print(rcv);
}
delay(1000);
}
It's just a modification of your code, not the way I would do it. It will only print out the first character of any response. You might also wish to consider printing out the ASCII value of what is received just in case it's a control character.