#include <NewPing.h>
int TRIGGER_PIN = 9;
int ECHO_PIN = 8;
int MAX_DISTANCE = 500;
int dist = 0;
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_SENSOR_DISTANCE);
void setup() {
Serial.begin(9600);// put your setup code here, to run once:
}
void loop() {
dist = sonar.ping_cm(500);
Serial.print(dist);
Serial.println(" cm");
delay(100);
}