How to use timer and also do actions?

Hello! I am trying to write a code for a timer of 15 seconds and I want that at the end of the 15 seconds an action will happen, and also, during the 15 seconds, will wait for a long button press.

to specify - timer 15 seconds is on, during that time, untill timer ends,

if a button is pressed long then do action 1,

if pressed short - do action 2,

if button isn't pressed and timer 15 seconds ends, do action 1.

can someone help me with that?

This is the programming section :wink: Show your best attempt.

Have a look at how millis() is used to manage timing in Several Things at a Time.

And see Using millis() for timing. A beginners guide if you need more explanation.