Alarm system with wireless remote control

Hi,

I am creating alarm system with wireless remote control.

I am using: 2 x nrf24l01, arduino uno, SIM800L and atmega328p.

I attached photos of circuits diagrams and program. I wrote a small program for GSM module(SIM800L).

#include<SoftwareSerial.h>
SoftwareSerial SerialSIM800L(7, 8); //SIM800L pajungimo kontaktai
//pajungimas
int reset_mygtukas=2;
int reset_busena=0;
int valdymo_mygtukas_off=3;
int valdymo_busena_off=0;
int valdymo_mygtukas_on=4;
int valdymo_busena_on=0;
int priekiniu_mygtukas=A1;
int priekiniu_busena=0;
int galiniu_mygtukas=A2;
int galiniu_busena=0;
int dangciu_mygtukas=A3;
int dangciu_busena=0;
int pir_jutiklis = 5;
int pir_jutiklio_busena;
int sirena = 6;
const int LED = A0;

//kintamieji
int sms_skaicius=0;
int sistemos_veikimas=0;

void setup()
{
  pinMode(reset_mygtukas,INPUT); //reser mygtukas - iejimas 2 pinas
  pinMode(valdymo_mygtukas_off,INPUT); //valdymo mygtukas off - iejimas 3 pinas 
  pinMode(valdymo_mygtukas_on,INPUT); //valdymo mygtukas on - iejimas 4 pinas 
  pinMode(priekiniu_mygtukas,INPUT); //priekiniu dureliu mygtukas - iejimas A1 pinas
  pinMode(galiniu_mygtukas,INPUT);  //galiniu dureliu mygtukas - iejimas A2 pinas
  pinMode(dangciu_mygtukas,INPUT); //variklio dangcio ir bagazines mygtukas - iejimas A3 pinas
  pinMode(pir_jutiklis,INPUT); //PIR jutiklis - iejimas 5 pinas
  pinMode(sirena,OUTPUT); //Sirena - isejimas 6 pinas
  pinMode(LED,OUTPUT); //Mikrsintis LED - isejimas A0 pinas
  SerialSIM800L.begin(9600);
  Serial.begin(9600);
}

void loop()
{
  Tikrinam_Ijungima(); //tikrinama ar sistema ijungima
}
//valdymas
void Tikrinam_Ijungima()
{
  valdymo_busena_on=digitalRead(valdymo_mygtukas_on);
  if(digitalRead(valdymo_busena_on==HIGH))// tikrina ar ijunge sistema 
  {
    SMS_ijungta(); //Siunciam SMS apie sistemos ijungima
    delay(1000);
    sistemos_veikimas=1; //sistema ijungta
    while(sistemos_veikimas=1)// kol sistema yra ijungta
    {
      digitalWrite(LED,HIGH);
      delay(100);
      digitalWrite(LED,LOW);
      delay(100);
      Tikrinam_Isjungima(); //tikrinama ar sistema isjungima
      Tikrinam_Judesi();// tikrinamas PIR judesio jutiklis
      Tikrinam_Priekines(); //tikrinami priekiniu dureliu jungtukai
      Tikrinam_Galines(); //tikrinami galiniu dureliu jungtukai
      Tikrinam_Dangciai(); //tikrinami variklio ir bagazines dangciai
      Tikrinam_Reset(); // tikrinama ar nenuresetinta signalizacija
     }
  }
}
void Tikrinam_Isjungima()
{
  valdymo_busena_off=digitalRead(valdymo_mygtukas_off);
  if(digitalRead(valdymo_busena_off==HIGH))// tikrina ar isjunge sistema 
  {
    SMS_isjungta(); //Siunciam SMS apie sistemos isjungima
    delay(1000);
    sistemos_veikimas=0; //sistema isjungta
    digitalWrite(LED,LOW);
    delay(100);
  }
}
//jutikliai
void Tikrinam_Judesi()
{
  pir_jutiklio_busena=digitalRead(pir_jutiklis); // tikrinamas PIR jutiklis is 7 pino
  if(pir_jutiklio_busena==HIGH) // tikrina ar suveike PIR jutiklis ir siuncia HIGH signala i Arduino
  {
    digitalWrite(sirena,HIGH); // aktyvuojama sirena 
    while(sms_skaicius<3) //SMS ziniuciu skaicius - 3
    {  
      SMS_pir(); //Siunciam SMS apie PIR jutikli
      Serial.println("DEMESIO! Suveike judesio jutiklis!");
      delay(1000);
    }
  }
}
void Tikrinam_Priekines()
{
  priekiniu_busena=digitalRead(priekiniu_mygtukas);
  if(digitalRead(priekiniu_busena==HIGH))// tikrina ar atidarytos priekines dureles
  {
    digitalWrite(sirena,HIGH); // aktyvuojama sirena 
    while(sms_skaicius<3) //SMS ziniuciu skaicius - 3
    {  
      SMS_priekines(); //Siunciam SMS apie atidarytas priekines dureles
    }
  }
}
void Tikrinam_Galines()
{
  galiniu_busena=digitalRead(galiniu_mygtukas);
  if(digitalRead(galiniu_busena==HIGH))// tikrina ar atidarytos galines dureles
  {
    digitalWrite(sirena,HIGH); // aktyvuojama sirena 
    while(sms_skaicius<3) //SMS ziniuciu skaicius - 3
    {  
      SMS_galines(); //Siunciam SMS apie atidarytas galines dureles
    }
  }
}
void Tikrinam_Dangciai()
{
  dangciu_busena=digitalRead(dangciu_mygtukas);
  if(digitalRead(dangciu_busena==HIGH))// tikrina ar atidarytas kapotas arba bagazine
  {
    digitalWrite(sirena,HIGH); // aktyvuojama sirena 
    while(sms_skaicius<3) //SMS ziniuciu skaicius - 3
    {  
      SMS_dangciai(); //Siunciam SMS apie atidarytas galines dureles
    }
  }
}
//resetas
void Tikrinam_Reset()
{
  reset_busena=digitalRead(reset_mygtukas);
  if(digitalRead(reset_busena==HIGH))// tikrina ir isjunge sirena nuspaudziant mygtuka 
  {
    SMS_reset(); //Siunciam SMS apie nuresetinta signalizacija
    delay(1000);
    digitalWrite(sirena,LOW); // isjungiama sirena 
    sms_skaicius=0; // nunulinamas SMS skaicius
  }
}
//sms zinutes
void SMS_pir()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("DEMESIO! Suveike judesio jutiklis!");//zinutes tekstas
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
  sms_skaicius++;
  Serial.println("DEMESIO! Suveike judesio jutiklis!");//zinutes tekstas
  delay(1000);
}
void SMS_priekines()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("DEMESIO! Atidarytos priekines dureles!");//zinutes tekstas
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
  sms_skaicius++;
  Serial.println("DEMESIO! Atidarytos priekines dureles!");//zinutes tekstas
  delay(1000);
}
void SMS_galines()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("DEMESIO! Atidarytos galines dureles!");//zinutes tekstas
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
  sms_skaicius++;
  Serial.println("DEMESIO! Atidarytos galines dureles!");//zinutes tekstas
  delay(1000);
}
void SMS_dangciai()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("DEMESIO! Atidarytas variklio dangtis arba bagazine!");//zinutes tekstas
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
  sms_skaicius++;
  Serial.println("DEMESIO! Atidarytas variklio dangtis arba bagazine!");
  delay(1000);
}
void SMS_reset()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("Aliarmas ISJUNGTAS. Sistema VEIKIA.");//zinutes tekstas
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
  Serial.println("Aliarmas ISJUNGTAS. Sistema VEIKIA. ");//zinutes tekstas
  delay(1000);
}
void SMS_ijungta()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("Sistema IJUNGTA.");//zinutes tekstas
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
  sms_skaicius=0;
  Serial.println("Sistema IJUNGTA. ");//zinutes tekstas
  delay(1000);
}
void SMS_isjungta()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("Sistema ISJUNGTA.");//zinutes tekstas
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
  sms_skaicius=0;
  Serial.println("Sistema ISJUNGTA. ");//zinutes tekstas
  delay(1000);
}

Now I need help with bidirectional wireless control. There must be: 3buttons, vibromotor, blinking LED and atmega328p. It must turn on/off and reset alarm system. I do not know how to write program for this…

void loop()
{
  Tikrinam_Ijungima(); //tikrinama ar sistema ijungima
}

While functions are a great idea, this is silly. If there is only one thing for loop() to do, just have it do it.

    while(sistemos_veikimas=1)// kol sistema yra ijungta

Why are you assigning the value 1 to sistemos_veikimas in a while statement?

  if(digitalRead(valdymo_busena_off==HIGH))// tikrina ar isjunge sistema

Why does the relationship between valdymo_busena_off and HIGH define whether to read from pin 0 or pin 1?

Why would you be reading from the hardware serial pins?

I gave up reading your code at that point.

I do not know how to write program for this...

For which end? What are the requirements?

if(digitalRead(valdymo_busena_off==HIGH))// tikrina ar isjunge sistema

it must be

if(digitalRead(valdymo_busena_off==1))// tikrina ar isjunge sistema

?

Why I cant assing the value 1 to sistemos_veikimas in a while statement? In proteus its working.

It must be:

If(sistemos_veikimas==1

?

For the end:

remote control has 3 buttons, blinking led and vibro motor.

For example:

1button: reset alarm 2button: on 3button: off

System: GSM module sends SMS, nrf24l01 module sends signal to wireless remote control. Vibromotor is working in the remote control.

When you press reset button:

//resetas
void Tikrinam_Reset()
{
  reset_busena=digitalRead(reset_mygtukas);
  if(digitalRead(reset_busena==HIGH))// tikrina ir isjunge sirena nuspaudziant mygtuka 
  {
    SMS_reset(); //Siunciam SMS apie nuresetinta signalizacija
    delay(1000);
    digitalWrite(sirena,LOW); // isjungiama sirena 
    sms_skaicius=0; // nunulinamas SMS skaicius
  }

when you press on button:

valdymo_busena_on=digitalRead(valdymo_mygtukas_on);
  if(digitalRead(valdymo_busena_on==HIGH))// tikrina ar ijunge sistema 
  {
    SMS_ijungta(); //Siunciam SMS apie sistemos ijungima
    delay(1000);
    sistemos_veikimas=1; //sistema ijungta
    while(sistemos_veikimas=1)// kol sistema yra ijungta
    {
      digitalWrite(LED,HIGH);
      delay(100);
      digitalWrite(LED,LOW);
      delay(100);
      Tikrinam_Isjungima(); //tikrinama ar sistema isjungima
      Tikrinam_Judesi();// tikrinamas PIR judesio jutiklis
      Tikrinam_Priekines(); //tikrinami priekiniu dureliu jungtukai
      Tikrinam_Galines(); //tikrinami galiniu dureliu jungtukai
      Tikrinam_Dangciai(); //tikrinami variklio ir bagazines dangciai
      Tikrinam_Reset(); // tikrinama ar nenuresetinta signalizacija
     }
  }

I thinking about something like this

void Tikrinam_Ijungima()
{
  if (radio.available())
  {
    bool done = false;    
    while (!done)
    {
      done = radio.read(msg, 1);      
      Serial.println(msg[0]);
      if(msg[0] == 333)// tikrina ar ijunge sistema 
      {
        delay(10);
        SMS_ijungta(); //Siunciam SMS apie sistemos ijungima
        delay(1000);
        sistemos_veikimas=1; //sistema ijungta
        while(sistemos_veikimas=1)// kol sistema yra ijungta
        {
          digitalWrite(LED,HIGH);
          delay(100);
          digitalWrite(LED,LOW);
          delay(100);
          Tikrinam_Isjungima(); //tikrinama ar sistema isjungima
          Tikrinam_Judesi();// tikrinamas PIR judesio jutiklis
          Tikrinam_Priekines(); //tikrinami priekiniu dureliu jungtukai
          Tikrinam_Galines(); //tikrinami galiniu dureliu jungtukai
          Tikrinam_Dangciai(); //tikrinami variklio ir bagazines dangciai
          Tikrinam_Reset(); // tikrinama ar nenuresetinta signalizacija
         }
        delay(10);
      }
    }
  else
  { 
    SMS_noRadio(); //Siunciam SMS apie radijo rysio klaida
  }
}

sorry for bad my english

if(digitalRead(valdymo_busena_off==1))

Is one of these ')' in the wrong place?

I suspect so.

Why I cant assing the value 1 to sistemos_veikimas in a while statement?

You can, but it doesn't make any sense to.

It DOES make sense to COMPARE the value in sistemos_veikimas to 1, but that is done using ==, not =.

In proteus its working.

That donkey crap software's behavior has NO bearing on reality.

PaulS: That donkey crap software's behavior has NO bearing on reality.

I do wish you'd come down off the fence, stop beating about the bush and prevaricating, and simply just say what you really mean. :D

it must be

while(sistemos_veikimas=1)

? sorry I am beginner.

it must be

NO! NO! NO!

It MUST be

   while(sistemos_veikimas == 1)

OOOK!

Now what about bidirectional RF module. Now I am trying to do to(on, off and reset functions)

//priedai
#include <SoftwareSerial.h>
#include <SPI.h> //Include SPI Code Library 
#include "nRF24L01.h" //Include NRF24L01 Code Library 
#include "RF24.h" //Inlcude NRF24 Code Library 

//moduliai
SoftwareSerial SerialSIM800L(7, 8); //SIM800L pajungimo kontaktai
RF24 radio(9, 10); // NRF24L01 pajungimo kontaktai (CE, CSN) 
const uint64_t pipe = 0xE8E8F0F0E1LL; //Start Pipe Communication Address

//pajungimas
int priekiniu_mygtukas=A1;
int priekiniu_busena=0;
int galiniu_mygtukas=A2;
int galiniu_busena=0;
int dangciu_mygtukas=A3;
int dangciu_busena=0;
int pir_jutiklis = 5;
int pir_jutiklio_busena;
int sirena = 6;
const int LED = A0;

//kintamieji
int msg[1];
int sms_skaicius=0;
int sistemos_veikimas=0;

void setup()
{
  pinMode(priekiniu_mygtukas,INPUT); //priekiniu dureliu mygtukas - iejimas A1 pinas
  pinMode(galiniu_mygtukas,INPUT);  //galiniu dureliu mygtukas - iejimas A2 pinas
  pinMode(dangciu_mygtukas,INPUT); //variklio dangcio ir bagazines mygtukas - iejimas A3 pinas
  pinMode(pir_jutiklis,INPUT); //PIR jutiklis - iejimas 5 pinas
  pinMode(sirena,OUTPUT); //Sirena - isejimas 6 pinas
  pinMode(LED,OUTPUT); //Mikrsintis LED - isejimas A0 pinas
  
  SerialSIM800L.begin(9600);
  Serial.begin(9600);
  
  radio.begin();
  radio.setDataRate(RF24_250KBPS);
  radio.openReadingPipe(1,pipe);
  radio.startListening();
}

//valdymas
void loop()
{
  if (radio.available())
  {
    bool done = false;    
    while (!done)
    {
      done = radio.read(msg, 1);      
      Serial.println(msg[0]);
      if(msg[0] == 333)// tikrina ar ijunge sistema 
      {
        delay(10);
        SMS_ijungta(); //Siunciam SMS apie sistemos ijungima
        delay(1000);
        sistemos_veikimas=1; //sistema ijungta
        sms_skaicius=0; // nunulinamas SMS skaicius
        while(sistemos_veikimas == 1)// kol sistema yra ijungta
        {
          digitalWrite(LED,HIGH);
          delay(100);
          digitalWrite(LED,LOW);
          delay(100);
          Tikrinam_Isjungima(); //tikrinama ar sistema isjungima
          Tikrinam_Judesi();// tikrinamas PIR judesio jutiklis
          Tikrinam_Priekines(); //tikrinami priekiniu dureliu jungtukai
          Tikrinam_Galines(); //tikrinami galiniu dureliu jungtukai
          Tikrinam_Dangciai(); //tikrinami variklio ir bagazines dangciai
          Tikrinam_Reset(); // tikrinama ar nenuresetinta signalizacija
         }
        delay(10);
      }
    }
  else
  { 
    SMS_noRadio(); //Siunciam SMS apie radijo rysio klaida
  }
}

void Tikrinam_Isjungima()
{
  valdymo_busena_off=digitalRead(valdymo_mygtukas_off);
  if(digitalRead(valdymo_busena_off==HIGH))// tikrina ar isjunge sistema 
  {
    SMS_isjungta(); //Siunciam SMS apie sistemos isjungima
    delay(1000);
    sistemos_veikimas=0; //sistema isjungta
    sms_skaicius=0; // nunulinamas SMS skaicius
    digitalWrite(LED,LOW);
    delay(100);
  }
}
//jutikliai
void Tikrinam_Judesi()
{
  pir_jutiklio_busena=digitalRead(pir_jutiklis); // tikrinamas PIR jutiklis is 7 pino
  if(pir_jutiklio_busena==HIGH) // tikrina ar suveike PIR jutiklis ir siuncia HIGH signala i Arduino
  {
    digitalWrite(sirena,HIGH); // aktyvuojama sirena 
    while(sms_skaicius<3) //SMS ziniuciu skaicius - 3
    {  
      SMS_pir(); //Siunciam SMS apie PIR jutikli
      Serial.println("DEMESIO! Suveike judesio jutiklis!");
      delay(1000);
    }
  }
}
void Tikrinam_Priekines()
{
  priekiniu_busena=digitalRead(priekiniu_mygtukas);
  if(digitalRead(priekiniu_busena==HIGH))// tikrina ar atidarytos priekines dureles
  {
    digitalWrite(sirena,HIGH); // aktyvuojama sirena 
    while(sms_skaicius<3) //SMS ziniuciu skaicius - 3
    {  
      SMS_priekines(); //Siunciam SMS apie atidarytas priekines dureles
    }
  }
}
void Tikrinam_Galines()
{
  galiniu_busena=digitalRead(galiniu_mygtukas);
  if(digitalRead(galiniu_busena==HIGH))// tikrina ar atidarytos galines dureles
  {
    digitalWrite(sirena,HIGH); // aktyvuojama sirena 
    while(sms_skaicius<3) //SMS ziniuciu skaicius - 3
    {  
      SMS_galines(); //Siunciam SMS apie atidarytas galines dureles
    }
  }
}
void Tikrinam_Dangciai()
{
  dangciu_busena=digitalRead(dangciu_mygtukas);
  if(digitalRead(dangciu_busena==HIGH))// tikrina ar atidarytas kapotas arba bagazine
  {
    digitalWrite(sirena,HIGH); // aktyvuojama sirena 
    while(sms_skaicius<3) //SMS ziniuciu skaicius - 3
    {  
      SMS_dangciai(); //Siunciam SMS apie atidarytas galines dureles
    }
  }
}
//resetas
void Tikrinam_Reset()
{
  reset_busena=digitalRead(reset_mygtukas);
  if(digitalRead(reset_busena==HIGH))// tikrina ir isjunge sirena nuspaudziant mygtuka 
  {
    SMS_reset(); //Siunciam SMS apie nuresetinta signalizacija
    delay(1000);
    digitalWrite(sirena,LOW); // isjungiama sirena 
    sms_skaicius=0; // nunulinamas SMS skaicius
  }
}
//sms zinutes
void SMS_pir()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("DEMESIO! Suveike judesio jutiklis!");//zinutes tekstas
  Serial.println("DEMESIO! Suveike judesio jutiklis!");//zinutes tekstas
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
  sms_skaicius++;
}
void SMS_priekines()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("DEMESIO! Atidarytos priekines dureles!");//zinutes tekstas
  Serial.println("DEMESIO! Atidarytos priekines dureles!");//zinutes tekstas
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
  sms_skaicius++;
}
void SMS_galines()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("DEMESIO! Atidarytos galines dureles!");//zinutes tekstas
  Serial.println("DEMESIO! Atidarytos galines dureles!");//zinutes tekstas
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
  sms_skaicius++;
}
void SMS_dangciai()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("DEMESIO! Atidarytas variklio dangtis arba bagazine!");//zinutes tekstas
  Serial.println("DEMESIO! Atidarytas variklio dangtis arba bagazine!");
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
  sms_skaicius++;
}
//valdymo sms zinutes
void SMS_reset()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("Aliarmas ISJUNGTAS. Sistema VEIKIA.");//zinutes tekstas
  Serial.println("Aliarmas ISJUNGTAS. Sistema VEIKIA. ");//zinutes tekstas
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
}
void SMS_ijungta()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("Sistema IJUNGTA.");//zinutes tekstas
  Serial.println("Sistema IJUNGTA. ");//zinutes tekstas
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
}
void SMS_isjungta()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("Sistema ISJUNGTA.");//zinutes tekstas
  Serial.println("Sistema ISJUNGTA. ");//zinutes tekstas
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
}
//klaidu sms zinutes
void SMS_noRadio()
{
  SerialSIM800L.println("AT+CMGF=1");    //To send SMS in Text Mode
  delay(1000);
  SerialSIM800L.println("AT+CMGS=\"+919495xxxxxx\"\r"); // telefonu numeris 
  delay(1000);
  SerialSIM800L.println("KLAIDA: nepavyko prisijungi radijo rysiu.");//zinutes tekstas
  Serial.println("KLAIDA: nepavyko prisijungi radijo rysiu.");//zinutes tekstas
  delay(200);
  SerialSIM800L.println((char)26);//the stopping character
  delay(1000);
}

Why I get this error “SMS_ijungta” was not declared in this scope

if(digitalRead(valdymo_busena_off==HIGH))

Again, ')' in wrong place?

AWOL: if(digitalRead(valdymo_busena_off==HIGH))

Again, ')' in wrong place?

Why ")" in wrong place?

I use this example http://www.circuitstoday.com/burglar-alarm-using-arduino-and-pir-sensor

And you're certain the example is correct?

Think about it: the expression "valdymo_busena_off==HIGH" can have one of two values: zero or one.

So you're going to do a digitalRead on one of the serial I/O pins.

I dont know. Maybe this example is not correct. I dont have enough time to do this project. I am a student and I have to complete it quickly. I really need HELP...

if I connected it to analog pins, it will be like

priekiniu_busena=analogRead(priekiniu_mygtukas);
  if(analogRead(priekiniu_busena==1))// tikrina ar atidarytos priekines dureles
  {

? and

analogWrite(LED,HIGH);
      delay(100);
      analogWrite(LED,LOW);
      delay(100);

Yes??

Reading analogue input pin zero or one makes a little more sense, but I still don't think you're on the right track.

Don't you think it's meant to be something simple like

  priekiniu_busena=digitalRead(priekiniu_mygtukas);
  if(priekiniu_busena==HIGH)

(Sorry, I don't know any Lithuanian, so "priekiniu_busena" is meaningless to me)

//pajungimas -connections
int reset_mygtukas=2; //reset button
int reset_busena=0; //reset_value
int valdymo_mygtukas_off=3; //remote_button_off
int valdymo_busena_off=0; //remote_value_off
int valdymo_mygtukas_on=4; //remote_button_on
int valdymo_busena_on=0; //remote_value_on
int priekiniu_mygtukas=A1; //front_door_button
int priekiniu_busena=0; //fornt_door_value
int galiniu_mygtukas=A2; //rear_door_button
int galiniu_busena=0; //rear_door_value
int dangciu_mygtukas=A3; //hood and trunk button
int dangciu_busena=0; //hood and trunk value
int pir_jutiklis = 5; //pir sensor
int pir_jutiklio_busena; //pir sensor value
int sirena = 6; //buzzer
const int LED = A0; //LED

//kintamieji
int sms_skaicius=0; //sms count
int sistemos_veikimas=0; //system (0=off, 1=on)

When car door, trunk or hood is opened (plus PIR sensor), the alarm system sends SMS and radio signal to wireless remote control.