import lejos.nxt.*;


/**
 * Test the overshoot after stop() at different speeds;
 * @author Roger
 */
public class InertiaTest
{
   public static void main(String[] args)
   {      
        LCD.drawString("Inertia Test", 0, 0);  // just so the program will not start immeditely
        Button.waitForPress();           
        rotate720();
        Motor.A.resetTachoCount();
        Motor.A.setSpeed(800);
        rotate720();  
   }
   /**
    * helper method - rotates to 720, stops, display tacho count, wait;
    */
   public static void rotate720()
   {
        Motor.A.forward();
        int count = 0;
        while( count < 720 )count = Motor.A.getTachoCount();         
        Motor.A.stop();
//       Motor.A.flt();
        LCD.drawInt(count , 0, 1);
        while(Motor.A.getActualSpeed()>0);
        LCD.drawInt(Motor.A.getTachoCount(), 7,1 );    
        Button.waitForPress();
        LCD.clear();
   }
}