Hi - I'm working on a "simple" project that is rapidly becoming complex and I'm stuck with some basic concepts that I'm sure some of the more seasoned vets on this board can solve in an instant. For now I'll phrase everything in simplistic terms to see if I can solicit some conceptual help before I get too deep into the code.
My project boils down to this - four momentary buttons, four LEDs. Each of the buttons should be available to the user once the program is loaded, and when pressed, each should light up it's own LED, BUT:
-a press of each button should light it's corresponding LED for only 100ms;
-two or more buttons can't be pressed at once;
-each button may not light up an LED again within 20 seconds of being pressed
Can anyone offer some conceptual advice or even some simple code? I started out with the debounce tutorial ( http://www.arduino.cc/en/Tutorial/Debounce
), which I understand, but - can I expand this to each of the four buttons in the same loop by adding the same code but with different buttons/pins?
As for the timing - what is a good approach here? Should I use millis() and "if" statements with subtractive timing?
Thanks in advance for your help.