import lejos.nxt.*;
@author
public class RotInterrupt
{
public void go()
{
System.out.println("Interrupt \n rotation");
Sound.twoBeeps();
Button.waitForPress();
Motor.A.rotate(720,true);
showRotation(1);
Motor.A.rotateTo(0,true);
showRotation(1);
}
public void showRotation(int row )
{
while(Motor.A.isRotating())
{
LCD.drawInt(Motor.A.getTachoCount(),4, 0, row);
if(Button.readButtons()>0) Motor.A.stop();
}
while(Motor.A.getActualSpeed()>0);
LCD.drawInt(Motor.A.getTachoCount(), 4,8,row);
Button.waitForPress();
}
public static void main(String[] args)
{
new RotInterrupt().go();
}
}