Cellphone type power button

every button or switch has two states,off and on.

when you press a button, changes from off to on.
when you release, it changes from on to off.

you can detect each state, and you can detect each change from one state to the other.

what I did was to use a timer similar to Blink Without Delay.

press (1st state change)
note the time
release (2nd state change)
check duration

if the release was less than 2 seconds, then ignore as it was not long enough.
if the release was over 2 seconds, then a new thing was done.

in my case, I also had an LED that would change after 2 seconds to let me know I had held more than 2 seconds.