The most recent iteration of my code DID work, I just hadn't checked the output file in a few runs. To clear things up for anyone having similar problems, I've posted my final Processing code below. Thanks so much for your help, PaulS!
import processing.serial.*;
Serial port;
PrintWriter output;
int BPM; // HOLDS HEART RATE VALUE FROM ARDUINO
void setup() {
// Create a new file in the sketch directory
output = createWriter("BPM.txt");
// GO FIND THE ARDUINO
println(Serial.list()); // print a list of available serial ports
// choose the number between the [] that is connected to the Arduino
port = new Serial(this, Serial.list()[1], 115200); // make sure Arduino is talking serial at this baud rate
port.bufferUntil('\n'); // set buffer full flag on receipt of carriage return
}
void serialEvent(Serial port){
String inData = port.readStringUntil('\n');
inData = trim(inData); // cut off white space (carriage return)
BPM = int(inData); // convert the string to usable int
// println(BPM);
}
void draw() { // Could use void loop() here instead?
output.println(BPM); // Write the BPM to the file
}
void keyPressed() {
output.flush(); // Writes the remaining data to the file
output.close(); // Finishes the file
exit(); // Stops the program
}