arduino programming for heart rate analysing

this is my code to count the number of pulses for 10 sec and then multiplying it by 6 to get the beat count

int sensorPin = A0; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
int count=0;
unsigned long time1=0; // store the initial time
unsigned long time2; // store the current time
void setup() {
// declare the ledPin as an OUTPUT:
pinMode(sensorPin, INPUT);
Serial.begin(9600);
}

void loop() {
// read the value from the sensor:
if(count==0)
{time1=millis();
}
time2=millis();
sensorValue = analogRead(sensorPin);
if(sensorValue>156)
{ increment();
}
if(time2>=time1+10000)
{ counter();
}

}
void increment()
{count++;
while(sensorValue>156)
{Serial.print("Sensor value is greater than .75V\n");
}
}
void counter()
{ count=count*6;
Serial.print("Heart beat is ");
Serial.print(count);
Serial.print(" per min\n");
time1=0;
time2=0;
count=0;
}