Setting Timer in Arduino for One minute

Hello Everyone,

I am new to Arduino and recently I was working on a pulse sensor module, my m/o is to calculate the times a heart beats in a minute using a pulse sensor.

I have a pulse signal output displayed in the serial plotter, using a threshold value of 512, I calculate the bpm and display it on an 16x2 LCD screen.

The issue is that I am unable to set a time of 60 seconds and I really cannot figure out a better way to write the code.

Please help as soon as possible.

Thank You.

#include <LiquidCrystal.h>

int ledpin = 13;
int sensorpin = 0;
double alpha = 0.75;
int period = 20;
double change = 0.0;
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
float bpm=0;

void setup() {
  // put your setup code here, to run once:
  pinMode(ledpin, OUTPUT);
  Serial.begin(9600);
   lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("BPM:- ");
  
}

void loop() {
  // put your main code here, to run repeatedly:
  static double oldvalue = 0;
  static double oldchange = 0;
  int rawvalue = analogRead(sensorpin);
  double value = alpha * oldvalue + (1 - alpha) * rawvalue;
  //Serial.print(rawvalue);
  Serial.print(",");
  Serial.println(value);
  
  if(value >=512)
  {
    bpm=bpm+0.5;
  }

  oldvalue = value;
  delay(period);

 lcd.setCursor(0, 1);
  lcd.print(bpm);

}

You need to use millis() for timing to avoid blocking other code. See the beginners guide at the top of the page.

UKHeliBob:
You need to use millis() for timing to avoid blocking other code. See the beginners guide at the top of the page.

I am really new to this, could you just write a part of the code and show for an example, please?
That would be great!

Follow his advice. Read that post. And then write what you think you need. If you still have problems, come back here and post your complete sketch between code tags.

You need to show that you are at least willing to try. Few people here will write your sketch for you. But nearly everyone is willing to help you correct it.

DangerToMyself:
Follow his advice. Read that post. And then write what you think you need. If you still have problems, come back here and post your complete sketch between code tags.

You need to show that you are at least willing to try. Few people here will write your sketch for you. But nearly everyone is willing to help you correct it.

Well, I did read it and the thing is that I did not understand most of it.
I haven't done basic programming also, my knowledge as of now is based on C# which I learnt in college after which I did not continue.
If you could lead me to a part of it, I will really appreciate it and it would be better.
Thank you.

Delta_G:
What you mean is that you are terribly lazy and reading and learning sound hard so could someone please just do it for you. Yes, someone could just do it for you but you'd have to pay for that. Post in Gigs and Collaborations. Be sure to include exact specifications and how much you're willing to pay.

Sorry sir/ma'am, if I offended you in any way.
I did not mean to do that at all. Yes, I might come out to be lazy but my intentions are not the way you think. I am really poor when it comes to programming knowledge, and lately I have not been getting good guidance as well so as to reach to a conclusion for this project.
I hope you understand, I am a college student and I surely cannot afford you or any programmer to write a sketch for me.
It was just an attempt to be guided than get a suggestion, I got enough suggestions already the only problem is that I do not even know how to work then out.
Thank you for your valuable time.

detective_lokii:
I hope you understand, I am a college student

Are you looking for us to do your homework for you?