I attached 3 files that I found that work for the 4-wire ultrasonic sensors, at least the one I have.
Create a directory in your arduino.x.x.x/libraries folder named Ping4 and copy the attached files there
in sketch:
#include <Ping4.h>
int TriggerPin = 12;
int EchoPin = 11;
Ping4 Sensor;
void setup() {
pinMode(TriggerPin, OUTPUT);
pinMode(EchoPin, INPUT);
Serial.begin(9600);
}
void loop() {
Sensor.Read();
Serial.println(Sensor.Distance());
delay(1000);
}
Moderator edit: The usual. Grrrr
Ping4.h (203 Bytes)
Ping4.cpp (325 Bytes)
keywords.txt (47 Bytes)