Delay timer in function without delaying main loop!

Hey there, and welcome to the community!

Using interrupts for your button is alright, though you definitely do not want to do anything within an interrupt that takes any noticeable amount of time. Use it to set a so-called ‘flag’ for the main loop, and get out of there as quickly as you can. Then, in the main loop check for said flag, and handle accordingly.

As for the delays, delay() will halt the system until it’s over, rendering it useless during that time. You’re probably going to want to look into ‘non-blocking’ delays and/or software timers.
For the former, there’s an example here: Delay(), vs “soft delay” [end of discourse]
For the latter, I suggest you take a look at the docs :smile:
Let us know if that helped :)!