Help with an interesting program.

Hello guys! I need some help with an interesting piece of program.
I have 2 sensors what gives me +5V when I activate it
An mobile phone
2 relay's
a buzzer
An IR Sensor and a remote
I want to make a security sistem what to work in this way:

  1. To can activate de system when I press a button on the remote and to make a short sound on buzzer(1 second), then, when i press another button to stop the system and to make a short sound on buzzer(2 seconds).
    2 To recognise the first sensor and then to activate firs relay
  2. To recognize the second sensor and then to activate the second sensor and to activate an output pin for 3 seconds(for phone call).

Can somenone help me with an example of program.
Thanks!

…you ask for complete code ?
read a little - then write code yourself

This example uses a remotecontrol to activate a motor (forw / reverse) At one end there is an end-switch to stop movement this direction

#include <IRremote.h>
int RECV_PIN = A0;
IRrecv irrecv(RECV_PIN);
decode_results results;
byte kode; // buffer for 4 bytes
const int fwd=8, rvs=4, stp=37; // define values from remote
int m1=5, m2=4, ebr=2;  // motor pins and 'end-break'


void setup ()
{
  pinMode (ebr, INPUT_PULLUP);
  attachInterrupt(0,stopp,FALLING);

  pinMode (A0,INPUT);
  pinMode (A1,OUTPUT);
  pinMode (A2,OUTPUT); // IR sensor connected to A0..A2
  digitalWrite (A1,0); //GND
  digitalWrite (A2,1); // 5V
  
  pinMode (m1,OUTPUT);
  pinMode (m2,OUTPUT);
  digitalWrite (m1,0);
  digitalWrite (m2,0);
  pinMode (10, OUTPUT);
  analogWrite (10,60);
  irrecv.enableIRIn(); // Start the receiver
}

void stopp()//stopper motoren
{
  digitalWrite(m1,0);
  digitalWrite(m2,0);
}

void loop()
{
  kode=0;
  if (irrecv.decode(&results)) 
  {
       Serial.println(results.value, HEX);
 
    kode=results.value & 255; // mask off, only last digits is of interest
    irrecv.resume(); // Receive the next value
  }
  //...........
 // if (kode!=0) 
  {
    Serial.print(kode);
    Serial.print('-');
  }
  switch(kode)
  {
  case fwd: //opp
    { 
      if(digitalRead(ebr)==HIGH)//båten er ikke oppe
      {
        digitalWrite(m1,1);
        digitalWrite(m2,0);
        break;
      }
    }
  case rvs:
    {
      digitalWrite(m1,0);
      digitalWrite(m2,1);
      break;
    }
  case stp:
    { 
      digitalWrite(m1,0);
      digitalWrite(m2,0);
      break;
    }
  }
}

RaduMoscu:
I want to make a security sistem what to work in this way:

  1. To can activate de system when I press a button on the remote and
    1a to make a short sound on buzzer(1 second),
    1b. then, when i press another button to stop the system and to make a short sound on buzzer(2 seconds).
    2 To recognise the first sensor and then
    2a. to activate firs relay
  2. To recognize the second sensor and then to activate the second sensor and to activate an output pin for 3 seconds(for phone call).

I see 6 separate small projects here. (I wonder if the bit in bold is a typing mistake - if not it might be 7th project)

Start by writing a short sketch to learn how to do each piece in isolation. The examples that come with the Arduino IDE probably cover most of what you need.

When you have figured it all out then you can see about combining your learning into a complete project.

Never try to eat an elephant in one bite. :slight_smile:

...R