PIR home security

Hello guys,
I’m a newbie into Arduino, and i’m deeply intrested in making a home security system with 4 PIR motion sensors and output on 16, 2 LCD screen.

I used the basic PIR code from arduino to get output on diferent LED’s for corresponding PIR’s; but the problem is at night, its hard for me to remember which LED is which zone! So i decided to hook it up to an LCD screen.

Im so depressed that my initial attempts with coding were an utter failure; but some how i got a sketch from codekaola.It works fine with one PIR, but i dont know how to modify the sketch to attach 3 more sensors!

This is the code that I got:

#include <LiquidCrystal.h>

int calibrationTime = 10; // seconds to calibrate PIR
long unsigned int pause = 5000; // timeout before we “all” motion has ceased
long unsigned int lowIn; // the time when the sensor outputs a low impulse

boolean lockLow = true;
boolean takeLowTime;

int flashCnt = 4; // number of times the LCD will flash when there’s motion
int flashDelay = 500; // number of ms to wait while flashing LCD
int pirPin = 7; // the digital pin connected to the PIR sensor’s output
int lcdPin = 13; // pin connected to LCD
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

void setup() {
// Calibrates the PIR

Serial.begin(9600);
pinMode(pirPin, INPUT);
pinMode(lcdPin, OUTPUT);

digitalWrite(pirPin, LOW);

clearLcd();

// give the sensor some time to calibrate
lcd.setCursor(0,0);
lcd.print(“Calibrating…”);

for(int i = 0; i < calibrationTime; i++){
lcd.print(".");
delay(1000);
}

lcd.print(“done”);
delay(50);
}

void clearLcd() {
// Clears the LCD, turns off the backlight
lcd.begin(20, 4);
lcd.clear();
digitalWrite(lcdPin, LOW);
}

void alertLcd() {
// Turns on the LCD backlight and notifies user of motion
lcd.setCursor(2, 1);
digitalWrite(lcdPin, HIGH);
lcd.print(“INTRUDER ALERT!!”);
lcd.setCursor(2, 2);
lcd.print("================");
}

void loop() {
// Main execution loop

if(digitalRead(pirPin) == HIGH) {
// flash an alert a few times
for (int c = 0; c < flashCnt; c++) {
alertLcd();
delay(flashDelay);
lcd.clear();
delay(flashDelay);
}

if(lockLow) {
// makes sure we wait for a transition to LOW before any further
// output is made:
lockLow = false;
delay(50);
}
takeLowTime = true;
}

if (digitalRead(pirPin) == LOW) {
clearLcd();

if (takeLowTime) {
// save the time of the transition from high to LOW
// make sure this is only done at the start of a LOW phase
lowIn = millis();
takeLowTime = false;
}

// if the sensor is low for more than the given pause,
// we assume that no more motion is going to happen
if (!lockLow && millis() - lowIn > pause) {
// makes sure this block of code is only executed again after
// a new motion sequence has been detected
lockLow = true;
delay(50);
}
}
}

CAN ANYONE PLEASE HELP ME WITH SKETCH MODIFICATION?

Thanking You

First suggestion: modify alertLcd() so that it takes a string as an argument eg alertLCD(“All is well”). Get that to work with your existing sketch. This will allow you to send a different message for each sensor later.

Next suggestion: learn about arrays. You will need arrays for each of the parameters such as pirPin, lockLow etc . Modify your sketch so that it uses for example pirPins[0] instead of pirPin.

Finally you can put a for loop just inside your main loop() that iterates over as many pir sensors as you have input pins- each one will have its own index into the arrays.

If you do all this you will have learnt a lot of valuable lessons about programming.

Heres a little hint as to what it might look like

int pirPins[] = {2, 4, 8, 3, 6};

void loop()
{
   for (int i=0; i <6; i++){
       
      if digitalRead(pirPins[i]) {
      // etc etc
      };
   } 
}

Thanks a lot for dopping by..but u know the thing is, i am a total novice in arduino..jus a few months...the code that i put above too, i dont understand even a line...! Im totally depressed...beenbsitting with this project for over 3 months now...
Are there any simple codes ( ready made), which has to b altered only a bit to get it to work?
Please help
Thanks