(Urgent) LDR Laser Alarm with disarm button

Hi there guys

I am a total noob to electronics and C programming, in desperate need of some help with an LDR Laser trip alarm. What I've managed to do is get the LEDs or Buzzers to blink when there is no light on the LDR, And I have a master switch to toggle the whole system on or off.

However, this is an installation piece and I'll be setting up a perimeter of beams, not just one beam bended all around but four beams as i would like to have four corresponding buttons to disarm the blinking buzzers or LEDs and the LDRs should then start searching for activity again after a brief amount of time...

This is an exam piece, so your help will be greatly appreciated. Thanks a lot.

Here is my code so far... http://dl.dropbox.com/u/60078359/LDR_Alarm_Master_Switch.ino

And a demo... http://dl.dropbox.com/u/60078359/LDR%20Alarm%20Demo.f4v

This is an exam piece ...

You didn't have to tell us that, we can tell by the 'Urgent' in the subject line.

Don

What course credits do we get?

Lol, Okay sorry for... "This is an exam piece". but if you help me, I could help you with things I am good at and that you need some assistance with someday. I just really need this now guys

To give you the direction to go:

convert all your global variables into arrays (of the same type). This way you can wrap your button check, analog read and condition check with a for loop going over all the entries of your arrays.

Thanks Pylon... but I dont totally understand, could you possibly give me an example of this in code?

An example, yes, but I will not do your work.

const int  buttonPin[] = { 4,5,6,7};    // the pin that the pushbutton is attached to

int buttonState[] = { 0, 0, 0, 0};         // current state of the button

and then:

for (byte i = 0; i < 4; i++) {
  buttonState[i] = digitalRead(buttonPin[i]);
}

Change the other parts accordingly and you’re almost done.