the led keeps going off!!!(when relay is closed!)

tru pin is suppost to stay on, but dont, CODE:

//z-parakeet inc.'s Fire Alarm Sketch

int ledPin = 13; // choose the pin for the LED
int buzzerPin = 3; //buzzer/alertor
int inputPin = 2;               // choose the input pin (for a pushbutton)
int val = 0;            // variable for reading the pin status
int truPin = 7;
int Alarms = 8;
int sil = 0;

void setup() {

  pinMode(buzzerPin, OUTPUT);   //declare BUZZER or allertor as a output!
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);  // declare pushbutton as input
  pinMode(truPin, OUTPUT);
  pinMode(Alarms, OUTPUT);
      digitalWrite(buzzerPin, HIGH);
      digitalWrite(ledPin, HIGH);
      digitalWrite(truPin, HIGH);
    digitalWrite(buzzerPin, LOW);
    digitalWrite(ledPin, LOW);

}



void loop(){
  val = digitalRead(inputPin);  // read input value
  if (val == LOW) {      // check if the input is HIGH
    digitalWrite(truPin, HIGH);
    digitalWrite(ledPin, HIGH);  // turn LED ON
    digitalWrite(buzzerPin, HIGH);
       ("FIRE");
    delay(150);
    digitalWrite(ledPin, LOW);
    delay(150);
    digitalWrite(buzzerPin, LOW);
    digitalWrite(Alarms, HIGH);
  } 
  else 
  {
    ("SYSTEM Clear");
    digitalWrite(Alarms, LOW);
    digitalWrite(truPin, LOW);


      }
}

We've asked you in the past to please give more information. There's no reason to type like you're using a cellphone... if you want answers, give full questions.

You digitalWrite(truPin, LOW) anytime you get a HIGH value from digitalRead(inputPin). So what is connected? How are you connecting? And please be specific.

wait, isthe input of HIGH supposed to yield the trupin to be on, or is the LOW input supposed to yield trupin on... cause right now it now it says to do the latter... however, like halley said, specifics would be appreciated and would benefit u even more... :wink:

("FIRE");

("SYSTEM Clear");

What are those two lines supposed to do?

I'll have to get in line with those who requests more information.

This is your code - (the two strange lines + all that has nothing to do with truPin)

Does this do what you want: ?

byte truPin = 7;
byte inputPin = 2;

void setup() {
pinMode(truPin, OUTPUT);
digitalWrite(truPin, HIGH);
}

void loop(){
byte val = digitalRead(inputPin); // read input value
if (val == LOW) { // check if the input is HIGH
digitalWrite(truPin, HIGH); // turn LED ON
}
else {
digitalWrite(truPin, LOW);
}
}

It should turn led on when the switch is pressed [reversed if using a pullup resistor].

...

im getting fed up...

...

im getting fed up...

...

fed up with what?

the pwnz0r:
I dont want to get rude or something, but you are defenetely acting like some 5yr old!

Please be so kind to tell us WHAT IS WRONG or we cannot help. And if we have to guess what is wrong with your stuff we can only hardly help which is frustrating for both parties...