multiple input monitoring

Hi there
I have 6 inputs labelled as:
input1
input2
input3
input4
input5
input6
How can I get the arduino to look at all its six inputs and if any of them go low to write an output low?

With a simple sketch.

if (INPUT1 && INPUT2 && INPUT3 && INPUT4 && INPUT5 && INPUT6) { //check if they are all high
OUTPUT = HIGH;
} //If not, at least one of them must be low
else OUTPUT = LOW;

ok thanks for that, I got this:

  if (input1 && input2 && input3 && input4 && input5 && input6) {        //check if any are high
   digitalWrite(Relay,        HIGH);
  } 
  else {
   digitalWrite(Relay,        LOW);
}

it seam's to write the Relay High regardless of the input's any idea's

any idea's

Yep... show the whole code so we can see the settings of the pins and so on, and wiring....

there is some other bits going on in here

// *** INPUT'S ***
const int input1 = 3;
const int input2 = 2;
const int input3 = 4;
const int input4 = 5;
const int input5 = 6;
const int input6 = 7;

// *** LED OUTPUT'S ***
const int LED1 = 15;
const int LED2 = 14;
const int LED3 = 13;
const int LED4 = 12;
const int LED5 = 11;
const int LED6 = 10;

// *** LED/RESET/RELAY OUTPUT'S ***
const int Relay = 8;
const int Reset = 9;
const int LED = 16;

int ledState = LOW; // ledState used to set the LED
long previousMillis = 0; // will store last time LED was updated
long interval = 1000; // interval at which to blink (milliseconds)

void setup()
{
// *** INPUT'S ***
pinMode(input1 , INPUT);
pinMode(input2 , INPUT);
pinMode(input3 , INPUT);
pinMode(input4 , INPUT);
pinMode(input5 , INPUT);
pinMode(input6 , INPUT);

// *** OUTPUT'S ***
pinMode(LED1 , OUTPUT);
pinMode(LED2 , OUTPUT);
pinMode(LED3 , OUTPUT);
pinMode(LED4 , OUTPUT);
pinMode(LED5 , OUTPUT);
pinMode(LED6 , OUTPUT);

// *** LED/RESET/RELAY OUTPUT'S ***
pinMode(Relay , OUTPUT);
pinMode(Reset , INPUT);
pinMode(LED , OUTPUT);

}

void loop() {
unsigned long currentMillis = millis(); // LED BLINKER

if(currentMillis - previousMillis > interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;

// if the LED is off turn it on and vice-versa:
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;

// set the LED with the ledState of the variable:
digitalWrite(LED, ledState);
}

if (digitalRead(input1)== LOW) { // INPUT 1
digitalWrite(LED1, HIGH);
}

if (digitalRead(input2)== LOW) { // INTPUT 2
digitalWrite(LED2, HIGH);
}

if (digitalRead(input3)== LOW) { // INTPUT 3
digitalWrite(LED3, HIGH);
}

if (digitalRead(input4)== LOW) { // INTPUT 4
digitalWrite(LED4, HIGH);
}

if (digitalRead(input5)== LOW) { // INTPUT 5
digitalWrite(LED5, HIGH);
}

if (digitalRead(input6)== LOW) { // INTPUT 6
digitalWrite(LED6, HIGH);
}

if (input1 && input2 && input3 && input4 && input5 && input6) { //check if any are high
digitalWrite(Relay, HIGH);
}
else {
digitalWrite(Relay, LOW);
}

if (digitalRead(Reset)== HIGH) { // Reset button
digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW);
digitalWrite(LED3, LOW);
digitalWrite(LED4, LOW);
digitalWrite(LED5, LOW);
digitalWrite(LED6, LOW);
}
}

Presumably at least one of the LED1-6 is on, so you know at least one input has gone low?

yes all that work's fine

ah... you're not reading the inputs in that if. You did digitalRead's on the fly in the ones where you set the LEDs, but didn't store those so in the main if where you set the relay, it doesn't know the status. (edit... ie you're checking if the pin number is high, not the value of the pin's input)

o I see, could I do this?

 if (digitalRead(input1) && digitalRead(input2) && digitalRead(input3) && digitalRead(input4) && digitalRead(input5) && digitalRead(input6)) {   //check if any are high

I guess.... why not try that 8)

Or if you think that makes the line long and cumbersome, plus the fact that you already need those reads for the LEDs, you could have some more values declared like input1Val and read them only once...

input1Val = digitalRead(input1);

... and then use those vals in the ifs to save a bit of typing and it looks neater

if (digitalRead(input6)==    LOW) {  // INTPUT  6
    digitalWrite(LED6,        HIGH);
  }

 
  if (input1 && input2 && input3 && input4 && input5 && input6)

input6, for example, has the value 7 - it will always be true.

Joes:

 if (digitalRead(input1) && digitalRead(input2) && digitalRead(input3) && digitalRead(input4) && digitalRead(input5) &&  digitalRead(input6) ) {    
//check if ALL are HIGH
   digitalWrite(Relay,        HIGH);
  } 
  else {  //one or more is LOW
   digitalWrite(Relay,        LOW);

I see now, ok thanks all for your help