This commit is contained in:
rio.loann 2023-04-24 09:22:21 +02:00
parent 41db41bbad
commit 9019f5145e
1 changed files with 19 additions and 1 deletions

View File

@ -1,11 +1,29 @@
#include <MeMCore.h>
float maxDist = 50;
MeDCMotor _leftMotor(9);
MeDCMotor _rightMotor(10);
MeUltrasonicSensor sensor(3);
void setup() {
// put your setup code here, to run once:
_leftMotor.run(0);
_rightMotor.run(0);
}
void loop() {
// put your main code here, to run repeatedly:
_leftMotor.run(-100);
_rightMotor.run(100);
while (sensor.distanceCm() < maxDist)
{
_leftMotor.run(100);
_rightMotor.run(100);
delay(2000);
}
}