Water Flow Sensor

Try this...

volatile unsigned NbTopsFan; //measuring the rising edges of the signal
const int hallsensor = 2;    //The pin location of the sensor

void rpm ()
{
  NbTopsFan++;
}

void setup()
{
  pinMode(hallsensor, INPUT);
  Serial.begin(9600);
  attachInterrupt(0, rpm, RISING); //and the interrupt is attached
}

void loop ()   
{
  unsigned temp;
  long Calc;                               

  delay (1000);
  noInterrupts();
  temp = NbTopsFan;
  NbTopsFan = 0;
  interrupts();

  Serial.print (temp, DEC);
  Serial.print (" ticks");
  Serial.write( '\t' );

  Calc = (((temp * 60) / 7) / 2);
  Serial.print (Calc, DEC);
  Serial.print (" L/hour");

  Serial.println();
}