esp/arduino/sketchdistanceSerial

17 lines
274 B
Plaintext
Raw Normal View History

2022-05-15 19:38:28 +02:00
#include "Ultrasonic.h"
Ultrasonic ultrasonic(8,9); // Trig et Echo
void setup() {
Serial.begin(9600);
pinMode (11, OUTPUT);
pinMode (12, OUTPUT);
}
void loop () {
int dist = ultrasonic.Ranging(CM);
Serial.print(dist);
Serial.println(" cm");
delay(100);
}