Pause code untill a button is pressed
The construct you are looking for is called while.
Instead of doing &quot;If the button is pressed then continue&quot; you need to do &quot;while the button is not pressed do nothing&quot;.
Assuming you have an &quot;active low&quot; button (that is, a resistor pulling it up to +5V when not pressed, so digitalRead(A2) == LOW is &quot;pressed&quot;), you can do:
while (digitalRead(A2) == HIGH) {
  // Do nothing
}

So while it's not pressed (digitalRead(A2) == HIGH) don't do anything.  As soon as digitalRead(A2) returns LOW (so it is not == HIGH any more) the while loop will finish and your sketch can continue.
I write all about the while loop in an article here.