#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(9600);}
void loop()
{
delay(100);
int uS = sonar.ping();
Serial.println(uS / US_ROUNDTRIP_CM);
Serial.println("cm.");
}
//NOTE:
//TRIGGER PIN 12
//ECHO PIN 11
#define TRIGGER_PIN 12
#define ECHO_PIN 11
#define MAX_DISTANCE 200
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
void setup()
{Serial.begin(9600);}
void loop()
{
delay(100);
int uS = sonar.ping();
Serial.println(uS / US_ROUNDTRIP_CM);
Serial.println("cm.");
}
//NOTE:
//TRIGGER PIN 12
//ECHO PIN 11