I am counting interrupts and no matter what I do it goes 1,2, 10, 210.... I cannot figure out why
Here is the code:
/***********************************************************************************************************************
-
Function Name: countPulses
-
Description : Increments pulses counter, this is called everytime the pin of the flowmeter goes from LOW to HIGH
-
Arguments : none
-
Return Value : none
***********************************************************************************************************************/
void countPulses_one() {
//increment number of pulses by 1, this is us counting number of pulses// This gives the time between pulses in milliseconds
int stop_time = millis();
float pulse_time = stop_time - start_time;Serial.print(String(pulse_time, 3));
Serial.print(" Pulse Time ");pulses_one_sum += pulse_time;
pulses_one++;
delay(10);
Serial.print(String(pulses_one, 3));
Serial.print(" Pulses ");if(pulses_one == 16){
pulses_one_sum = pulses_one_sum/16;
float freq = 1000/pulses_one_sum;
Serial.print(String(freq, 5));
Serial.println(" ");
//zero them back out
pulses_one_sum = 0;
pulses_one_sum = 0;
}start_time = stop_time;
}