You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
261 B
17 lines
261 B
#include "SR04.h"
|
|
#define TRIG_PIN 12
|
|
#define ECHO_PIN 11
|
|
SR04 sr04 = SR04(ECHO_PIN,TRIG_PIN);
|
|
long a;
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
delay(1000);
|
|
}
|
|
|
|
void loop() {
|
|
a=sr04.Distance();
|
|
Serial.print(a);
|
|
Serial.println("cm");
|
|
delay(1000);
|
|
}
|
|
|