int echopin = 2;
int trigpin =3;
int Time;
int Distance;
void setup() {
// put your setup code here, to run once:
pinMode(trigpin, OUTPUT);
pinMode(echopin, INPUT);
Serial.begin(9600);
Serial.print("Ultrasonic Distance:...");
}
void loop()
{
// put your main code here, to run repeatedly:
digitalWrite(trigpin, LOW);
digitalWrite(trigpin, HIGH);
Time =pulseIn (echopin,HIGH);
Distance= Time * 0.0172;
Serial.print("Time:");
Serial.print(Time);
Serial.print(" microseconds");
delay(1000);
Serial.print(",Distance:" );
Serial.print(Distance);
Serial.println("cm");
delay(1000);
}