Phys/CSci 135: Assignments
Lab 6. Gears
Drive (page 52)
import lejos.nxt.*;
public class Drive {
public static void main(String[] args) {
Motor.B.forward();
Motor.C.forward();
while (Button.ESCAPE.isPressed() == false) {}
}
}
Lift (page 54)
import lejos.nxt.*;
public class Lift {
public static void main(String[] args) {
while (Button.ESCAPE.isPressed() == false) {
if (Button.LEFT.isPressed() == true) {
Motor.A.forward();
} else if (Button.RIGHT.isPressed() == true) {
Motor.A.backward();
} else {
Motor.A.stop();
}
}
}
}