Created
November 25, 2013 21:26
-
-
Save ruisantos16/7649175 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 | |
#define TRIGGER_PIN 12 | |
#define ECHO_PIN 11 | |
#define MAX_DISTANCE 200 | |
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance. | |
void setup() { | |
Serial.begin(9600); | |
} | |
void loop() { | |
delay(50); | |
unsigned int uS = sonar.ping_cm(); | |
Serial.print(uS); | |
Serial.println(“cm”); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment