Merge branch 'develop'

This commit is contained in:
Gauthier BASSEREAU 2024-03-12 14:38:44 +01:00
commit a1f49fc3b3
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
#include "Arduino.h"
#include "Wire.h"
#include "MeMCore.h"
// Declare 1 variable of type MeUltrasonicSensor at PORT_3
MeUltrasonicSensor sensor(PORT_3);
void setup() {
// Initialize the serial port at 9600 baud
Serial.begin(9600);
}
void loop() {
// Use the distanceCm() method to retrieve the distance of the obstacle
float distance = sensor.distanceCm( );
// Use the print() method of the Serial port to send the distance
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
// Add a small delay to avoid continuous printing
delay(100);
}