1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-08 23:46:08 +01:00
Arduino/targets/libraries/Sonar/examples/sonar/sonar.pde

23 lines
398 B
Plaintext
Raw Normal View History

#include <Ultrasound.h>
Ultrasound ultrasound(2);
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print("Ping took: ");
Serial.print(ultrasound.readMicroseconds());
Serial.print(" us. Distance is: ");
Serial.print(ultrasound.readCentimeters());
Serial.print(" cm, ");
Serial.print(ultrasound.readInches());
Serial.print(" in.");
Serial.println();
delay(1000);
}