roomba
This commit is contained in:
parent
41db41bbad
commit
9019f5145e
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue