مشکل من در ارتباط با ارینو و SIM800 میباشد . چرا اردینو پس از دو یا چند روز غیر فعال میشود ولی پس از ریست شدن به خوبی کار میکند . البته
ماژول SIM800 در هر حال به خوبی کار میکند. و مشکل از اردینو میباشد. نمونه کد:#include <SoftwareSerial.h>
SoftwareSerial SIM800(7, 8);
char incoming_char=0; //Will hold the incoming character from the Serial Port.
int led_status = 0;
int led1 = 10;
int led2 = 13;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
SIM900power();
Serial.begin(19200); // set the baud rate
SIM900.begin(19200); // for GSM shield
delay(20000); // give time to log on to network.

SIM900.print("AT+CMGF=1\r"); // set SMS mode to text
delay(100);
SIM900.println("AT+CNMI=2,2,0,0,0\r");
//SIM900.print("AT+CLIP=1\r"); // turn on caller ID notification

digitalWrite(led1, LOW);// Set led to LOW
digitalWrite(led2, LOW);
// Serial.println("AT+CMGD=1,4"); //Delete all SMS in box
}

void sendSMS(char led_status){ //SEND SMS

SIM900.print("AT+CMGF=1\r"); // AT command to send SMS message
delay(1000);
SIM900.println("AT+CMGS=\"+98XXXXXXXXX\"\r"); // recipient's mobile number, in international format
delay(1000);
if (led_status==0)
{
SIM900.println("ALARM ON");
}
else

{
SIM900.println("ALARM OFF");
}
delay(1000);
SIM900.println();
delay(5000); // give module time to send SMS
}
void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(7000);

}




void loop() {
//#a1s on & #a0s off
if(SIM900.available() >0)
{
incoming_char=SIM900.read();
if (incoming_char=='#')
{
delay(10);
incoming_char=SIM900.read();
if (incoming_char=='a')
{
delay(10);
incoming_char=SIM900.read();
if (incoming_char=='0')
{
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
}
else if (incoming_char=='1')
{
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
}
else if (incoming_char=='S')
{
digitalRead(led1);
led_status=digitalRead(led1);
led_status=digitalRead(led2);
Serial.print(led_status); // prints status on serial terminal
sendSMS(led_status);
}
delay(10);
}
// End AT command with a ^Z, ASCII code 26

delay(5000);

led_status=digitalRead(led1);
led_status=digitalRead(led2);
Serial.print(led_status); // prints status on serial terminal
sendSMS(led_status);
SIM900.println((char)26);
}
}
}