SoundCarModified
import lejos.nxt.*;
 
public class SoundCar 
{
    public static void main(String [] args)
    {        
        RandomDrive rd;
        AvoidFront af;
        PlaySounds ps;
        DriveTowardsLight dl;
 
        LCD.drawString("Sound Car",0,0);
        LCD.refresh();
 
        rd = new RandomDrive("Drive",1, null);
        dl = new DriveTowardsLight("Light",2,rd);
        af = new AvoidFront ("Avoid",3,dl);
        ps = new PlaySounds ("Play ",4,af);
 
           rd.start();
           dl.start();
           af.start();
        ps.start();
 
        while (! Button.ESCAPE.isPressed())
        {
            rd.reportState();
            dl.reportState();
            af.reportState();
            ps.reportState();
        }
 
        LCD.clear();
        LCD.drawString("Program stopped",0,0);
        LCD.refresh();
 
    }    
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License