Stap 6: Test Code uploaden
#include < NewPing.h >
#define TRIGGER_PIN 12;
#define ECHO_PIN 11;
#define MAX_DISTANCE 200;
NewPing sonar (TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
VOID Setup {}
Serial.begin(115200);
}
void loop {}
delay(50);
unsigned int ons = sonar.ping();
Serial.Print ("Ping:");
Serial.Print(US / US_ROUNDTRIP_CM);
Serial.println("cm");
}