1 import lejos.nxt.Button;
 2 import lejos.nxt.LCD;
 3 import lejos.nxt.Motor;
 4 import lejos.util.Delay;
 5 
 6 /**
 7  * Stop after 4 revolutions based on time, then based on tacho count
 8  * @author Roger
 9  *
10  */
11 public class MotorTutor2 {
12 
13      public static void main(String[] args) 
14      {
15           LCD.drawString("Program 2", 0, 0);
16           Button.waitForAnyPress();
17           Motor.A.setSpeed(720);
18           Motor.A.forward();
19           LCD.clear();
20           Delay.msDelay(2000);
21           LCD.drawInt(Motor.A.getTachoCount(),0,0);
22           Motor.A.stop();
23           LCD.drawInt(Motor.A.getTachoCount(),0,1);
24           Motor.A.backward();
25           while (Motor.A.getTachoCount()>0); 
26           LCD.drawInt(Motor.A.getTachoCount(),0,2);
27           Motor.A.stop();
28           LCD.drawInt(Motor.A.getTachoCount(),0,3);
29           Button.waitForAnyPress();
30      }
31 
32 }
33 
34