measuring water flow speed using water flow sensor

Hello,

I have connected water flow sensor with my beaglebone black and trying to measure the water flow. Below is my code which I have written in bonescript but I am sure it is not giving me the right results. Can someone help?

var b = require(‘bonescript’);

var pin = ‘P8_12’;

b.pinMode(pin, b.INPUT);

b.attachInterrupt(pin, true, b.RISING, interruptCallback);

var inerruptCall = 1;
var Calc = 0;

function interruptCallback(x){
inerruptCall++;
Calc = (inerruptCall * 60 / 7.5);
console.log(Calc);
//console.log(x);
}