Minor things:
You are assuming inputs will be pulled high when active. This may be a result of reading the unfortunate "tutorials" on the Arduino site. In practice, buttons (and most sensors) should be wired to ground and have pull-up resistors to 5V so that they are active LOW. This minimises the risk should wires to the buttons (etc.) be shorted to ground. Also, by setting a pin to an INPUT but writing it HIGH (as I mentioned before) you activate the internal pull-up in the MCU and probably do not need any other. I have not changed this for the present.
Major things:
You have used a delay() function for 900 seconds - this will do just what it says - absolutely nothing will happen for about fifteen minutes except for the siren continuing to sound even if you press the "disarm" button!
I have therefore substituted a piece of code which allows all other things to happen but checks every time through the loop to see if fifteen minutes has passed.
Now, you want "memory" of two things - whether the system is "armed" or not, and whether it is "alarmed" or not. I have defined these a "booleans" because they are either true or false; one or the other. Actually, I have not really used the "alarmed" and "strobed" flags, but they will be useful for enhancements.
Such as? Well, there are all sorts of things to consider. So far, the code does not distinguish between your "door" and your "PIR". Should it?
What about if either of these is still tripped when the fifteen minute timeout happens? Should the siren continue? (It should not.) You can use the "alarmed" and "strobed" flags to take care of such complications.
Note that I have coded for "disarm" taking priority over "set".
Hope you get your hardware soon. (Have you not an Arduino and some LEDs to try it out on already?)
//#include <LiquidCrystal.h>
//LiquidCrystal lcd(13,12,11,10,A5,A4)
// Input pins
int pirpin = 8;
int doorpin = 7;
int setpin = 6;
int disarmpin = 5;
// Output pins
int sirenpin = 4;
int siren2pin = 3;
int strobepin = 9;
// var - the missing pieces!
boolean armed;
boolean alarmed;
boolean strobed;
unsigned long count1 = 0; // will store initial time
// Have we completed the specified interval since last confirmed event?
// "marker" chooses which counter to check
boolean timeout(unsigned long *marker, unsigned long interval) {
if (millis() - *marker >= interval) {
*marker += interval; // move on ready for next interval
return true;
}
else return false;
}
void setup()
{
pinMode(pirpin, INPUT);
pinMode(doorpin, INPUT);
pinMode(setpin, INPUT);
pinMode(disarmpin, INPUT);
pinMode(sirenpin, OUTPUT);
pinMode(siren2pin, OUTPUT);
pinMode(strobepin, OUTPUT);
armed = false;
alarmed = false;
strobed = false;
}
void loop()
{
if (digitalRead(setpin) == HIGH) { // Can be armed
if (digitalRead(disarmpin) == LOW) // unless disarm is also held
armed = true;
}
if (armed && digitalRead(pirpin) == HIGH)
{
alarmed = true;
digitalWrite(sirenpin, HIGH);
strobed = true;
digitalWrite(strobepin, HIGH);
count1 = millis(); // set the countdown
//delay(900000);
//digitalWrite(sirenpin, LOW);
}
if (armed && digitalRead(doorpin) == HIGH)
{
alarmed = true;
digitalWrite(sirenpin, HIGH);
strobed = true;
digitalWrite(strobepin, HIGH);
count1 = millis(); // set the countdown
}
if (digitalRead(disarmpin) == HIGH)
{
armed = false;
alarmed = false;
digitalWrite(sirenpin, LOW);
strobed = false;
digitalWrite(strobepin, LOW);
}
if (timeout(&count1, 900000UL )) { // Enough siren?
alarmed = false;
digitalWrite(sirenpin, LOW);
}
}