sense the distance with the ultrasonic sensor, and serial.print it

This commit is contained in:
Gabri6 2023-04-24 11:28:26 +02:00
parent 25c8ad4ebc
commit 1c3402a245
1 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,17 @@
#include <MeMCore.h>
MeUltrasonicSensor sensor(3);
float distance;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
distance = sensor.distanceCm();
Serial.print(distance);
Serial.print("\n");
}