import lejos.nxt.*; import lejos.util.*; // to be able to use Delay methods /** Play with a motor's tachometer a bit. @author Roger (from a www.lejos.org tutorial) @author modified by Sharon Tuttle @version 2015-02-05 **/ public class TachoPlay { /** trying out setSpeed and getTachoCount and msDelay to play with a motor's tachometer @param args not used **/ public static void main(String[] args) { System.out.println("TachoPlay"); Button.waitForAnyPress(); // set the speed for the motor connected // to port B to 720 degrees per second Motor.B.setSpeed(720); Motor.B.forward(); // clear the LCD screen, // delay the main thread of execution for // 2000 milliseconds, // look at the current tachometer count // before and after stopping the motor LCD.clear(); Delay.msDelay(2000); LCD.drawInt(Motor.B.getTachoCount(), 0, 0); Motor.B.stop(); LCD.drawInt(Motor.B.getTachoCount(), 0, 1); Button.waitForAnyPress(); } }