با سلام
من می خوام با استفاده از ماژول sim800L و برد اردینو r3 ارسال و دریافت sms رو انجام بدم
متاسفانه تونستم باهاش ارسال sms کنم ولی در دریافت بشدت مشگل دارم .
کد ریز استفاده کردم
لطفا در صورت امکان راهنمایی کنید


#include <SoftwareSerial.h>
#include <String.h>
SoftwareSerial sim800l(10, 11); // RX, TX
int s =0;
void setup()
{
sim800l.begin(9600);
Serial.begin(9600);
sim800l.print("ATZ");
delay(300);

}

void loop()
{

//------------------------------------
sina=Serial.read();
if (s>0 )
{
//SendTextMessage();
RTextMessage();
//DialVoiceCall();
}
//--------------------------------------

Serial.println(sim800l.read());
delay(500);
}

void SendTextMessage()
{
Serial.println("Sending Text...");
sim800l.print("AT");
delay(200);
sim800l.print("AT+CSCA=\"+9891100500\"\r");
delay(200);
sim800l.print("AT+CMGF=1\r"); // Set the shield to SMS mode
delay(100);
//Serial.println(sim800l.read());
sim800l.print("AT+CMGS=\"+98911...3400\"\r");
delay(700);
sim800l.print("This is: ");
sim800l.print(" test");
sim800l.print("\r"); //the content of the message
delay(500);
sim800l.print((char)26);//the ASCII code of the ctrl+z is 26 (required according to the datasheet)
delay(100);
Serial.println("Text Sent.");
delay(500);

}

void RTextMessage()
{
Serial.println("recive Text...");
sim800l.print("AT+CMGR=1\r"); // Set the shield to SMS mode
delay(200);
// send data only when you receive data:
if (!sim800l.available()) {
// read the incoming byte:
char intx = sim800l.read();

// say what you got:
Serial.print("I received: ");
Serial.println(intx);
}
}

void DialVoiceCall()
{
sim800l.print("AT");
delay(200);
sim800l.print("ATD+098911...3400;");//dial the number, must include country code
sim800l.print("\r");
delay(200);
Serial.print("I call... ");
}