ya correct, but i unable to get new message notification, the AT+CNMI is command for new message notification but how i can use this command
hi kunal,
This is the simple example for receiving and read SMS.I hope that it will help you,
void switchModule(){
digitalWrite(onModulePin,HIGH);
delay(2000);
digitalWrite(onModulePin,LOW);
}
void setup(){
Serial.begin(115200); // UART baud rate
delay(2000);
pinMode(led, OUTPUT);
pinMode(onModulePin, OUTPUT);
switchModule(); // switches the module ON
for (int i=0;i < 5;i++){
delay(5000);
}
Serial.println("AT+CMGF=1"); // sets the SMS mode to text
delay(1000);
}
void loop(){
Serial.println("AT+CMGR=1"); //Reads the first SMS
Serial.flush();
for (x=0;x < 255;x++){
data[x]='\0';
}
x=0;
do{
while(Serial.available()==0);
data[x]=Serial.read();
x++;
if(data[x-1]==0x0D&&data[x-2]=='"'){
x=0;
}
}while(!(data[x-1]=='K'&&data[x-2]=='O'));
data[x-3]='\0'; //finish the string before the OK
Serial.println(data); //shows the message
delay(5000);
}