Multiple Inputs With 2 Buttons

I'm trying to put together a system that uses two buttons for input. When button a is pressed it does one action, when button b is pressed it does another action and when both buttons are pressed it does a third action. I have this much working. What I'd like to do is to be able to hold both buttons down and depending on how long they were held do different actions. For instance if they are held for more than 1 sec but less than 3 secs it should do one action. If they're both held for more than 3 but less than 5 it should do another action. I can make this work also. Where I run in to trouble is that I'd like to have feedback at the 1, 3 and 5 second intervals like an LED flashing to let the user know how long they've held the buttons.

Right now I'm using 2 interrupts to monitor the buttons. Right now it's on the button release that I'm checking to see whether both buttons were pressed at the same time and how long they were held for. I'm thinking maybe to check this when they're pressed somehow and starting an interrupt timer when they're pressed that will flash the LED at the 1, 3 and 5 second intervals and keep track of which action should be done on release. Is there an obvious easier way that I'm missing?

Thanks!

To add a little to my post, I just tried starting a timer to trigger an interrupt when both buttons are pressed with an ISR to blink the LED and then restart the timer. The problem I run in to now is that in order to blink the LED I have to delay for 500ms which I can't do in an ISR :frowning:

I have a couple ideas I'm going to try.

You shouldn't need interrupts to do what you need. You should take a look at the example that comes with the Arduino IDE, Blink Without Delay.
That way, you won't need any delays, and you won't need to use interrupts as well.

Also, you should take a look at this library, created by AlphaBeta, very useful button library!
http://www.arduino.cc/playground/Code/Button

And here is an excellent piece of code, which I used as a guide to successfully implement press and hold functions for a button.

I think your challenge is to build into your loop some timing checks to see how close to each other the press/holds are on the two buttons.

The tricky part is that you have to worry about debouncing each of them also, so you'll have multiple timers to manage.