Пример #1
0
 /*
  * This method makes the robot drive FRONT or BACK depending on the direction it is given.
  */
 public void drive(Direction direction) {
   if (direction == Direction.FRONT) {
     Motor.A.forward();
     Motor.B.forward();
   } else if (direction == Direction.BACK) {
     Motor.A.backward();
     Motor.B.backward();
   }
 }
Пример #2
0
  /*
   * This method makes the robot turn 90 deg to the given direction
   */
  public void turnNXT(Direction direction) {
    if (direction == Direction.RIGHT) {
      Motor.A.rotate(237);

    } else if (direction == Direction.LEFT) {
      Motor.B.rotate(237);
    }
  }
Пример #3
0
 public static void main(String[] args) {
   Motor.B.rotate(1440, false);
 }
Пример #4
0
 /*
  * This method makes the robot stop.
  */
 public void stop() {
   Motor.A.stop();
   Motor.B.stop();
 }