Ultrasound

This commit is contained in:
Lucas Marais 2023-03-31 09:17:12 +02:00
parent 4ef9ba22ab
commit 7292715015
2 changed files with 27 additions and 0 deletions

9
roomba/roomba.ino Normal file
View File

@ -0,0 +1,9 @@
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}

View File

@ -0,0 +1,18 @@
#include "MeMCore.h"
#include <SoftwareSerial.h>
#include <Wire.h>
MeUltrasonicSensor ultraSensor(PORT_3); /* Ultrasonic module can ONLY be connected to port 3, 4, 6, 7, 8 of base shield. */
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print("Distance : ");
Serial.print(ultraSensor.distanceCm() );
Serial.println(" cm");
delay(200); /* the minimal measure interval is 100 milliseconds */
}