Hi friends.......im using arduino mega and GSM shield from GEETECH. I have a problem that the commands AT+CMGL="ALL" doesnot work and also the command AT+CMGR=1,0 does not work i am unable to receive sms. THe command CMGR worked for some time but i was not getting the whole msg and was getting a part of it only. Im using hardware serial i suppose that the buffer of 64 bytes gets full so i cannot get full sms but im not sure about that.
Im attaching the code so please someone help me.
#include <String.h>
void setup()
{
pinMode(13, OUTPUT);
Serial.begin(9600);
delay(100);
Serial.println("AT"); //Because we want to send the SMS in text mode
delay(800);
Serial.println("ATE0"); //Because we want to send the SMS in text mode
delay(300);
Serial.println("AT+CMGF=1"); //Because we want to send the SMS in text mode
delay(300);
Serial.println("AT+CPMS="SM""); //Preferred SMS Message Storage
delay(300);
Serial.println("AT+CNMI=1,2,0,0,0"); //Preferred SMS Message Storage
delay(300);
while (Serial.available())
Serial.write(Serial.read());
}
void loop()
{
if (Serial.available())
Serial.println("AT+CMGL="ALL"");
delay(1000);
while (Serial.available())
Serial.write(Serial.read());
Serial.println("AT+CMGR=1,0");
delay(1000);
while (Serial.available())
Serial.write(Serial.read());
Serial.end();
delay(50);
Serial.begin(9600);
delay(50);
}