How do I use an "or" statement in arduino?

I need to make an "if" statement read multiple inputs, and if one of them is triggered, to run the statement. How would i do this?

Context:

 void loop(){
  do
  {
    digitalWrite(LED1, LOW);
    digitalWrite(LED2, LOW);
    sw1 = digitalRead(S1);
    sw2 = digitalRead(S2);
    sw3 = digitalRead(S3);
    sw4 = digitalRead(S4);
  }
  while ( sw1 == HIGH );
  
  while ( true )
  {
    val1 = digitalRead(R1);
    val2 = digitalRead(R2);
    val3 = digitalRead(R3);
    val4 = digitalRead(R4);
    if (val1 == HIGH) {      <--- OR STATEMENT NEEDS TO GO HERE AND READ FROM val2, val3, and val4 as well as val1
          digitalWrite(LED1, HIGH);
          delay(10);
          digitalWrite(LED1, LOW);
          if (val1 == HIGH) { <---- SAME HERE!
            digitalWrite(LED2, HIGH);
            delay(10);
            digitalWrite(LED2, LOW);
          }
    }

  }
}
if (value==1 || value==2) {
  // do something
}

Two pipe symbols mean "or" (single pipe symbol is a bitwise OR, IIRC)...

So - in your case:

if (val1 == HIGH || val2 == HIGH || val3 == HIGH || val4 == HIGH) {
  // stuff
}

:slight_smile:

Your question seems to be at odds with the title of the thread. If your question is:-

I need to make an "if" statement read multiple inputs, and if one of them is triggered, to run the statement.

The look up the "switch" construct in the arduino reference.

If it was the title then this was answered above.

Spookily similar thread.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1270666137

Spookily similar thread.

Just noticed that myself; I wonder which is the "real world" and which is the "bizarro world"...?

:wink: