This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <NewPing.h> | |
#define TRIGGER_PIN 3 | |
#define ECHO_PIN 4 | |
#define MAX_DISTANCE 200 | |
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); | |
void setup() { | |
Serial.begin(115200); | |
} | |
void loop() { | |
delay(50); | |
Serial.println((0.034027/2)*sonar.ping_median(10)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment