Created
August 8, 2020 05:34
-
-
Save isaiah7p/ebd4b249566f5b0f8f81680a6d1d4164 to your computer and use it in GitHub Desktop.
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 2 | |
#define MAX_DISTANCE 200 | |
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); | |
void setup() { | |
Serial.begin(9600); | |
} | |
void loop() { | |
delay(1000); | |
Serial.print("Ping CM: "); | |
Serial.print(sonar.ping_cm()); | |
Serial.print("Ping In: "); | |
Serial.println(sonar.ping_in()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment