Cannot read signal from flow meter

Thank you guys for your comments!

I managed to solve the problem, it was a stupid thing of my part: instead of plugging the sensor on Pin 2 of the PWM section I was plugging it on the Pin 2 Digital In section. I got confused because Arduino Mega is different from other models... Anyway, thank you very much!