I'm currently working on a flow meter, which measures in GPH. I'm trying to set it up so it displays the current gph usage and two resettable total gallon used counters. The sketch counts the number of pulses from the sensor every second or so. I then take the flow measurement( which is pulses * gals per pulse) and add it to totalgallonsA. TotalgallonsA += flowgal; // both are float

The problem I'm having is totalgallonsA instead of increasing always goes back to zero?I can post the complete code if needed, I have it on my other computerI'm very new to programming, and don't know where to begin??Matt

Floating point doesn't seem like a good bet for that sort of thing - you're going to be getting unpredictable rounding errors that could get quite large. Better IMO to define the resolution you're going to measure at (tenths of gallons, hundredths, thousandths etc) and store your counters as fixed point integer numbers.

I only provide help via the forum - please do not contact me for private consultancy.

I agree. A flow meter that generating pulses per unit of material flowed is best dealt with using integer math. it's rather straight forward counting of pulses in a fixed time interval and of course updating the total flow value, I see no advantages to using floating point math and several disadvantages.

/*** Invoked by interrupt0 once per rotation of the hall-effect sensor. Interrupt* handlers should be kept as small as possible so they return quickly.*/void pulseCounter(){ // Increment the pulse counter pulseCount++;}