Ping sensor with three or four pins?
You have 4 pins.


Vcc: +5V supply voltage (it stands for Collector Voltage)
GND: Ground.
Trig: Causes an ultrasound pulse to be generated (it stands for Trigger)
Echo: Tells you when an echo has been received.


You can see how to wire and use it here: http://www.instructables.com/id/Easy-ultrasonic-4-pin-sensor-monitoring-hc-sr04/