Is there any way to freeze Arduino code or 74HC595 Shift Register?

I am using a 74HC595 shift register to control a 7 segment display, and I want to make a diffuse button which will act as a button that stops the timer. Is there any way to do this?

Easily. Read the button state, if button state changes set a variable to 1 or 0, then while(variable == 1) { do nothing} .

Thanks, I’ll try it.

Remember to refresh the value in the loop or the loop will never end, so you don't actually do nothing

While ( variable == 1) variable = digitalRead(...);