//******************************************************* // FlowMeter //******************************************************* void setupFlowMeter() { pinMode(hallsensor, INPUT); //initializes digital pin 2 as an input attachInterrupt(0, pulseCounter, RISING); //and the interrupt is attached loopTime = millis(); sei(); //enable interupts } void pulseCounter() { //This is the function that the interupt calls pulseCount++; //This function measures the rising and falling edge of the hall effect sensors signal } void checkFlow() { if(millis() >= (loopTime + 2000)){ Calc = (pulseCount * 60 / (7.5 * 2)); //(Pulse frequency x 60) / 7.5Q, = flow rate in L/hour flowMenu(); pulseCount = 0; loopTime = millis();; // Updates loopTime } }