How to caculate QRS interval?

So im working on my project now and im just the beginer in micro controller, does anyone know how to find QRS duration ?now im using AD8232 and aruduino uno
thank you, i hope anyone can help me

qrs.PNG

Do you want to identify the labeled spikes in your picture qrs.PNG and measure the interval between them and, maybe average them ? Post the code you used to generate safds.PNG

6v6gt: Do you want to identify the labeled spikes in your picture qrs.PNG and measure the interval between them and, maybe average them ? Post the code you used to generate safds.PNG

Sorry for the late repyl and thank. Im just using the code from sparkfun.

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);}

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html . Then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.. :)

TomGeorge: Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html . Then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.. :)

Okey thank for the reminder

Hi,

The format of your code is quite compressed. Spreading your code out to make it readable does not slow it down. Hint: when you are writing your code, occasionally select TOOLS, Auto Format, or press CTRL-T.

Try your code below that I have edited.

void setup()
{
  Serial.begin(9600);  // initialize the serial communication
  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));
  }
  delay(1);   //Wait for a bit to keep serial data from saturating
}

Hope it helps.. Tom... :)