Re: Simple help with programming code.

if(digitalRead(sensor == HIGH))

Pay very close attention to parentheses.

If you've set "sensor" to "1" (you didn't post all the sketch, tut-tut, and you didn't post it using the "code" (#) button in the editor, double tut-tut) then your digitalRead would read pin 1.
If "sensor" was any other value, it would always read pin zero.
I don't imagine that's what you intended.

You may need to read about pull-up resistors and floating input pins.

OK, "sensor" is 9.
9 != HIGH, so you're reading pin zero.

Pin 9 is defined as a digital input, but doesn't have a pull-up enabled.
Have you got an external pull-up or pull-down on this pin?
Once you've fixed the condition, this may become important.

Do you see how this:

  digitalWrite(siren, HIGH);
  digitalWrite(buzzer, HIGH);
  digitalWrite(statusLED, HIGH);
  delay(50);
  digitalWrite(siren, LOW);
  digitalWrite(buzzer, LOW);
  digitalWrite(statusLED, LOW);
  delay(50);
  digitalWrite(siren, HIGH);
  digitalWrite(buzzer, HIGH);
  digitalWrite(statusLED, HIGH);
  delay(50);
  digitalWrite(siren, LOW);
  digitalWrite(buzzer, LOW);
  digitalWrite(statusLED, LOW);

repeats the exact same code several times?

A "for" loop would shorten your program, and give the bugs fewer places to hide.

This was my second post

?

Thanks for all your help.

If I were to draw a circuit diagram, it would be extremely complicated. This is a car alarm project I am currently working on as my first major arduino project.

The sensor and siren run off 12VDC so I have a 5V relay for the siren(the 5V, connects the positive trigger for the alarm to the positive terminal), and a 12V relay for the sensor(the negative sensor trigger output, connects to the positive terminal activating the relay and connecting the pin 10 supplying positive 5V constantly so when the relay is complete there will be current flowing from pin 10 to pin 9).

I am using an arduino nano, and supplying external power through the 5V pin. So i cannot use it as a base.

The buzzer, boardLED, statusLED, greenLED and redLED are for testing purposes and management of the alarm status. (statusLED in my dashboard of my car.

As far as writing this code, I based it off the BlinkLED example and just expanded it and repeated it. The checking status of pin 9 'sensor' was my first use of a more extensive code such as the 'for loop' which i am having trouble with.

As for the second post, I meant thread/topic. And I'm new to this particular forum, so I was unfamiliar with protocol and rules. Such as posting code with the # button.