Implemented AvoidObject behaviour and TextLCD
[des2015.git] / mart / ev3 / ex2 / nl / ru / des / behaviours / WandererBehaviour.java
@@ -1,8 +1,11 @@
-package nl.ru.des;
+package nl.ru.des.behaviours;
 
 import lejos.hardware.Sound;
 import lejos.hardware.motor.EV3LargeRegulatedMotor;
+import lejos.robotics.Color;
 import lejos.robotics.subsumption.Behavior;
+import nl.ru.des.bluetooth.ColorMemory;
+import nl.ru.des.sensors.ColorSensor;
 
 public class WandererBehaviour implements Behavior {
        private EV3LargeRegulatedMotor leftMotor, rightMotor;
@@ -31,10 +34,10 @@ public class WandererBehaviour implements Behavior {
                leftMotor.forward();
                rightMotor.forward();
                while (!suppressed) {
-                       String current = colorSensor.getCurrentColor();
-                       if (current == "Yellow" || current == "Blue" || current == "Red") {
+                       int current = colorSensor.getCurrentColor();
+                       if (current == Color.YELLOW || current == Color.BLUE || current == Color.RED) {
                                Sound.beep();
-                               BTController.SendMessage(current);
+                               cm.addColor(current);
                        }
                        Thread.yield();
                }
@@ -46,5 +49,4 @@ public class WandererBehaviour implements Behavior {
        public void suppress() {
                suppressed = true;
        }
-
 }