I am relatively new to this... I'm trying to use Arduino to control some LEDs for an art project. I have 3 motion sensors, each one controls a different LED. I simply want the LEDs to come on when their respective sensor detects motion. With the code below, the LEDs come on when their sensor is tripped, but if all three sensors are tripped at the same time (or in any combination of 2), they do not come on together. Can anyone help me fix this simple code? Thanks so much!!
void setup()
{
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void loop()
{
if(digitalRead(5)==1)
{
digitalWrite(11,1);
delay(10000);
}
if(digitalRead(5)==0)
{
digitalWrite(11,0);
delay(10000);
}
if(digitalRead(6)==1)
{
digitalWrite(12,1);
delay(10000);
}
if(digitalRead(6)==0)
{
digitalWrite(12,0);
delay(10000);
}
if(digitalRead(7)==1)
{
digitalWrite(13,1);
delay(10000);
}
if(digitalRead(7)==0)
{
digitalWrite(13,0);
delay(10000);
}
}