3 import lejos
.hardware
.Sound
;
4 import lejos
.hardware
.motor
.EV3LargeRegulatedMotor
;
5 import lejos
.robotics
.subsumption
.Behavior
;
7 public class WandererBehaviour
implements Behavior
{
8 private EV3LargeRegulatedMotor leftMotor
, rightMotor
;
9 private ColorSensor colorSensor
;
10 private boolean suppressed
;
12 public WandererBehaviour(ColorSensor colorSensor
, EV3LargeRegulatedMotor leftMotor
, EV3LargeRegulatedMotor rightMotor
) {
13 this.leftMotor
= leftMotor
;
14 this.rightMotor
= rightMotor
;
15 this.colorSensor
= colorSensor
;
19 public boolean takeControl() {
24 public void action() {
26 leftMotor
.setSpeed(300);
27 rightMotor
.setSpeed(300);
31 String current
= colorSensor
.getCurrentColor();
32 if(current
== "Yellow" || current
== "Blue" || current
== "Red"){
38 rightMotor
.stop(true);
42 public void suppress() {