1 
 2 import lejos.nxt.*; // this is required for all programs that run on the NXT
 3 
 4 
 5 /**
 6  *Motor runs forward then backward as button is pressed.
 7  * @author Roger
 8  */
 9 public class BasicMotorTest
10 {
11 
12     public static void main(String[] args)
13     {
14 
15         Motor.A.forward();
16         LCD.drawString("FORWARD", 0, 0);
17         Button.waitForPress();
18         Motor.A.backward(); // you could use  Motor.A.reverseDirection  instead
19         LCD.drawString("BACKWARD", 0, 1);
20         Button.waitForPress();
21         Motor.A.reverseDirection();
22         LCD.drawString("FORWARD", 0, 2);
23         Button.waitForPress();
24         Motor.A.stop();
25     }
26 }
27 
28