Hi,
Does anyone know how to program a timer set to 0-500ms that will start counting when a button is pressed down, therefore executing the code for that button. After 500miliseconds the button will switch off and the timer would reset again and be ready for the next button to be pressed. If the timer has already started by pressing one button and has not finished to 500ms and another button is pressed, would like it to interrupt the timer and reset it again.

If anyone could help me, would be much appreciated.