Hi guys! First of all i would like to say hello to all uP enthusiast. I just started to discover Arduino, and I'm fully suprised how powerfull thing it is.
But now I need your help I have a problem and totally don't know why it happens.
I wrote simple program, making my output pin HI when two of my input pins are HI otherwise output pin = LOW.
I'm a bit confused couse It seems to be easy but it's doesn't work as it should.
When I have HI signal on two my inputs, my output voltage going to HI directly, but when one of my input going LOW then output should be LOW as well but it's LOW after 5 seconds, so switching to HI is ok, but switching to LOW takes always 5 seconds.
Here is the proof:
And here is my last tested program:
int button_1 = 8;
int button_2 = 9;
int output_pin = 13;
int buttonState_1 = 0;
int buttonState_2 = 0;
void setup ()
{
pinMode(button_1, INPUT);
pinMode(button_2, INPUT);
pinMode(output_pin, OUTPUT);
}
void loop()
{
buttonState_1 = digitalRead(button_1);
buttonState_2 = digitalRead(button_2);
if (buttonState_1 == HIGH && buttonState_2 == HIGH)
{
digitalWrite(output_pin, HIGH);
}
else
{
digitalWrite(output_pin, LOW);
}
}
Switching problem? Have no idea. Maybe I should use FOR or WHILE loop as a control structure?
Thanks for your time!
Best regards!