Update sketchDistanceSerial-Ultrasonic.ino
This commit is contained in:
parent
6ee9698503
commit
b75ba7c515
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#include "Ultrasonic.h"
|
#include "Ultrasonic.h"
|
||||||
|
|
||||||
#define echoPin 9 // attach pin D2 Arduino to pin Echo of HC-SR04
|
#define echoPin 9 // attach pin D2 Arduino to pin Echo of HC-SR04
|
||||||
|
@ -18,7 +17,7 @@ void setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop () {
|
void loop () {
|
||||||
distance = sensor.Ranging(CM);
|
distance = sensor.Ranging(CM); // CM or INC
|
||||||
Serial.print("Distance: ");
|
Serial.print("Distance: ");
|
||||||
Serial.print(distance);
|
Serial.print(distance);
|
||||||
Serial.println(" cm");
|
Serial.println(" cm");
|
||||||
|
|
Loading…
Reference in New Issue