Looping until a button is pressed

For that you need to get rid of all the delay()s and use millis() to manage the timing without blocking as illustrated in Several Things at a Time

...R