Hi guys,just bought an Arduino Uno for a school project.
To cut it short, I have several inputs with push buttons.
Once one button is pressed, I have 15 seconds to press the next button to display a fare else the system resets. I have tried using some IF count loops, but it does not really count down 15secs, it just loops the code 15times..
Im using 'if (digitalRead(SwitchPin1) == HIGH && digitalRead(SwitchPin2) == HIGH);'
This line requires both buttons to be pressed simultaneously instead of one after the other..should I use Serial Analog read?
I would be greatful if anyone could help me with this..I'm really going crazy!!
digitalWrite(SwitchPin1, LOW); // pulldown resistors are activated
Back to the reference section for you.
If you need to press two switches within a given period of time, you'll need to record when each switch was pressed (millis()). When both switches have been pressed, compute the difference in times. If small enough, do something. Otherwise, do something else.
Looping, reading the same pair of switches 15 times is accomplishing nothing.