May be I am doing a stupid question but: if sensor like water flow ones are like a switch that every turn make the output going high for a short time, why have they 3 pins?
I think it would be sufficent to have 2. Using a pull up resistor, one must be connected to digital_in and to the resistor going at 5v and the second connected to GND.
What's the reason of using one more pin? thanks
It depends on the sensor. If it's a 'passive' sensor using say a magnetic reed switch that senses a magnet spinning on the flow meter's impeller then only two wires would be required. However if the sensor uses a 'active' sensor, say a hall effect magnetic switch then the hall effect devices requires a voltage source to operate, so needs three wires.