DriveForward.java
package Caprani;
import lejos.nxt.*;
import lejos.robotics.subsumption.*;
 
public class DriveForward implements Behavior {
    private boolean suppressed = false;
 
    public boolean takeControl() {
        return true;
    }
 
    public void suppress() {
        suppressed = true;
    }
 
    public void action() {
        suppressed = false;
        Motor.A.forward();
        Motor.C.forward();
 
        while(!suppressed) {
            Thread.yield();
        }
 
        Motor.A.stop(); // clean up
        Motor.C.stop();
    }
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License