Hi, I´m trying to make a project where I´m conecting the arduino to two beacon light towers.
I whant to make a OR gate that is trigged when one of the is green light is on more than 20 seconds.
The OR gate is working but trigger also when the beacon light tower is flashing green.
Can some one please help me with this, can i use two if statements after eachother to do this
if input 1 or 2 is high
if input longer than 30s
output on
else output of
int inputpin1 = 2;
int inputpin2 = 3;
int outputpin1 = 4;
int inputpin1Status = 0;
int inputpin2Status = 0;
void setup()
{
pinMode(outputpin1, OUTPUT);
pinMode(inputpin1, INPUT);
pinMode(inputpin2, INPUT);
}
void loop()
{
inputpin1Status = digitalRead(inputpin1);
inputpin2Status = digitalRead(inputpin2);
if (inputpin1Status == HIGH || inputpin2Status == HIGH )
{
digitalWrite(outputpin1, HIGH);
}
else
{
digitalWrite(outputpin1, LOW);
}
}