diff --git a/romba/romba.ino b/romba/romba.ino new file mode 100644 index 0000000..2013f02 --- /dev/null +++ b/romba/romba.ino @@ -0,0 +1,35 @@ +#include "MeMCore.h" +#include "Arduino.h" +#include "Wire.h" +#include "SoftwareSerial.h" + + +MeDCMotor _leftMotor(9); +MeDCMotor _rightMotor(10); +MeUltrasonicSensor ultraSensor(PORT_3); + +void setup() { + // put your setup code here, to run once: + Serial.begin(9600); + +} + +void loop() { + if (ultraSensor.distanceCm()<20){ + int x=random(-360,360); + _leftMotor.run(x); + _rightMotor.run(x); + delay(500); + } + + else{ + _leftMotor.run(200); + _rightMotor.run(-200); + + + + } + + // put your main code here, to run repeatedly: + +}