The construct you are looking for is called while
.
Instead of doing "If the button is pressed then continue" you need to do "while the button is not pressed do nothing".
Assuming you have an "active low" button (that is, a resistor pulling it up to +5V when not pressed, so digitalRead(A2) == LOW
is "pressed"), 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.