1 import lejos.nxt.Button;
2 import lejos.nxt.LCD;
3 import lejos.nxt.Motor;
4 import lejos.util.Delay;
5
6
7
8
9 @author
10
11
12 public class MotorTutor4 {
13
14
15 public static void main(String[] args) {
16 LCD.drawString("Tutor 4", 0, 0);
17 Button.waitForAnyPress();
18 while(Button.readButtons()>0);
19 LCD.clear();
20 Motor.A.rotateTo(1440, true);
21 while(Motor.A.isMoving())
22 {
23 Delay.msDelay(200);
24 LCD.drawInt(Motor.A.getTachoCount(),0,0);
25 if(Button.readButtons()>0) Motor.A.stop();
26 }
27 LCD.drawInt(Motor.A.getTachoCount(),0,1);
28
29 Button.waitForAnyPress();
30 }
31
32 }
33
34