Remembering button state

Look at the OP's code again maybe?
edit: and then the thread title. BTW, how complicated do you think a state machine is? He needs three states; green, yellow, red, and none for the button.

What do -you- want he should have?