Merge branch 'develop'

This commit is contained in:
Laure BEL 2024-03-11 09:33:40 +01:00
commit 0dc63bef0c
1 changed files with 34 additions and 0 deletions

34
roomba/roomba.ino Normal file
View File

@ -0,0 +1,34 @@
#include "Arduino.h"
#include "Wire.h"
#include "MeMCore.h"
#include "SoftwareSerial.h"
MeDCMotor _leftMotor(9);
MeDCMotor _rightMotor(10);
MeUltrasonicSensor ultrasonicSensor(PORT_3);
void setup() {
// put your setup code here, to run once:
_leftMotor.run(0);
_rightMotor.run(0);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if (ultrasonicSensor.distanceCm()>= 20){
Serial.println(ultrasonicSensor.distanceCm());
_leftMotor.run(-100);
_rightMotor.run(100);
}else{
_leftMotor.stop();
_rightMotor.stop();
delay(1000);
_leftMotor.run(100);
_rightMotor.run(100);
delay(1000);
}
}