Heart rate monitor (AD8232) coding adjustment help needed!

Hi all,

I am working on a sparkfun AD8232 heart rate monitor and their related tutorial (AD8232 Heart Rate Monitor Hookup Guide - learn.sparkfun.com) however I am trying to make some adjustments to the code.

The supplied code is:

void setup() {
  // initialize the serial communication:
  Serial.begin(9600);
  pinMode(10, INPUT); // Setup for leads off detection LO +
  pinMode(11, INPUT); // Setup for leads off detection LO -

}

void loop() {
  
  if((digitalRead(10) == 1)||(digitalRead(11) == 1)){
    Serial.println('!');
  }
  else{
    // send the value of analog input 0:
      Serial.println(analogRead(A0));
  }
  //Wait for a bit to keep serial data from saturating
  delay(1);
}

I would like to change the coding so that I will be able to get a plain text file or similar for 20 seconds of ECG monitoring. At the moment I have go onto the serial monitor and copy and paste a section of the continuous output of voltages.

I am very new to this and so far my attempts have not been very successful so any help is very appreciated!

Thank you very much in advance!

At the moment I have go onto the serial monitor and copy and paste a section of the continuous output of voltages.

You could use a different serial terminal application, such as coolterm.
You could write your own application.

I would like to change the coding so that I will be able to get a plain text file

Where? Do you have a hard-drive attached to your Arduino?

PaulS:
Where? Do you have a hard-drive attached to your Arduino?

No I have it attached directly to my computer.
Thanks for your help!

No I have it attached directly to my computer.

So, how do you expect the Arduino to write to it?

You can look in this article. I think this article give your solution..
Microcontroller Arduino Project Simple Monitoring System ECG.