Button issues....

Hello,
I’m new to Arduino - there’s something I’d like to add to my script code to enable me to only loop the first piece of code, until a button is pressed, then for it to loop the second piece of code. Hope this makes sense…

//libraries to install and include

#include <CapacitiveSensor.h>
#include <PCM.h>

int fsrPin = 0; // the FSR and 10K pulldown are connected to a0
int fsrReading; // the analog reading from the FSR resistor divider

//audio file addition
const unsigned char sample PROGMEM = {
129, 127
};
CapacitiveSensor cs_2_4 = CapacitiveSensor(2,4);

void setup(void) {
// Send debugging information via the Serial monitor
Serial.begin(9600);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(9, OUTPUT);
pinMode(13, OUTPUT);
}

void loop(void) {
//FIRST PIECE OF CODE
//Set LED to On.
digitalWrite(13, HIGH);
{
long start = millis();
long total1 = cs_2_4.capacitiveSensor(25); //can change sensitivity here

Serial.print(millis() - start); // check on performance in milliseconds
Serial.print("\t"); // tab character for debug windown spacing

Serial.println(total1); // print sensor output 1
if(total1 > 6000) { //can change threshold for
startPlayback(sample, sizeof(sample));
delay(2000);//delay for repeat
}

delay(75); }// delay to limit data to serial port

//SECOND PIECE OF CODE…

fsrReading = analogRead(fsrPin);

Serial.print("Analog reading = ");
Serial.print(fsrReading); // the raw analog reading

//Threshholds, qualitatively determined
if (fsrReading <= 10) {
Serial.println(" - No pressure"); digitalWrite(6, HIGH); digitalWrite(5, LOW); digitalWrite(9, LOW);
} else if (fsrReading <= 860) {
Serial.println(" - <15"); digitalWrite(6, HIGH); digitalWrite(5, LOW); digitalWrite(9, LOW);
} else if (fsrReading <= 890) {
Serial.println(" - 15-20"); digitalWrite(6, HIGH);digitalWrite(5, HIGH); digitalWrite(9, LOW);
} else {
Serial.println(" - > 20"); digitalWrite(9, HIGH);digitalWrite(5, HIGH);digitalWrite(6, HIGH);
delay(75);}
}

I'd like to add to my script code to enable me to only loop the first piece of code, until a button is pressed,

Simplistically, you could wrap the code to be repeated in a while loop with an exit condition that tests the value of a digitalRead() of the button pin.

Thanks, will look into how to do that. BW