package nl.ru.des;
-import java.io.File;
-
import lejos.hardware.Audio;
import lejos.hardware.ev3.EV3;
import lejos.hardware.ev3.LocalEV3;
+import lejos.hardware.lcd.Font;
import lejos.hardware.motor.EV3LargeRegulatedMotor;
import lejos.hardware.port.MotorPort;
import lejos.hardware.sensor.EV3TouchSensor;
public class Main {
public static void main(String[] args) {
- LCDPrinter lcdprinter = new LCDPrinter();
- LCDPrinter.print("Starting up");
- lcdprinter.start();
- LCDPrinter.print("Brick...");
EV3 brick = LocalEV3.get();
+ LCDPrinter lcdprinter = new LCDPrinter(brick.getGraphicsLCD(), Font.getSmallFont());
+ LCDPrinter.print("Starting up systems");
+ lcdprinter.start();
- LCDPrinter.print("Audio...");
+ LCDPrinter.print("Loading audio...");
Audio audio = brick.getAudio();
WavPlayer wavplayer = new WavPlayer(audio);
wavplayer.start();
- WavPlayer.playWav(new File("bootaudio.wav"));
+ WavPlayer.playWav("boot.wav");
- LCDPrinter.print("Keylistener...");
+ LCDPrinter.print("Loading keylistener...");
brick.getKey("Escape").addKeyListener(new ButtonListener());
- //Get motors
- LCDPrinter.print("Motors...");
+ LCDPrinter.print("Loading motors...");
EV3LargeRegulatedMotor rightMotor = new EV3LargeRegulatedMotor(MotorPort.D);
EV3LargeRegulatedMotor leftMotor = new EV3LargeRegulatedMotor(MotorPort.A);
rightMotor.setSpeed(300);
rightMotor.setAcceleration(1000);
leftMotor.setAcceleration(1000);
- //Get sensors
- LCDPrinter.print("Touch...");
+ LCDPrinter.print("Loading touch sensors...");
EV3TouchSensor leftTouch = new EV3TouchSensor(brick.getPort("S1"));
EV3TouchSensor rightTouch = new EV3TouchSensor(brick.getPort("S4"));
- LCDPrinter.print("Light...");
+ LCDPrinter.print("Loading light sensor...");
NXTLightSensor lightSensor = new NXTLightSensor(brick.getPort("S2"));
- LCDPrinter.print("Ultrasone...");
+ LCDPrinter.print("Loading ultrasone sensor...");
EV3UltrasonicSensor ultraSensor = new EV3UltrasonicSensor(brick.getPort("S3"));
- WavPlayer.playWav(new File("bootsystem.wav"));
+ WavPlayer.playWav("bootsystem.wav");
- //Initialize behaviours
- LCDPrinter.print("Behaviours...");
+ LCDPrinter.print("Initializing behaviours...");
Behavior[] behaviorList = new Behavior[] {
new WandererBehaviour(leftMotor, rightMotor),
new AvoidHighObjectBehaviour(leftMotor, rightMotor, ultraSensor),
new StayInFieldBehaviour(lightSensor, leftMotor, rightMotor),
};
- WavPlayer.playWav(new File("calibrate.wav"));
+ WavPlayer.playWav("calibrate.wav");
- LCDPrinter.print("Arbitrator...");
+ LCDPrinter.print("Initializing arbitrator...");
Arbitrator arb = new Arbitrator(behaviorList);
- WavPlayer.playWav(new File("takeoff.wav"));
+ WavPlayer.playWav("takeoff.wav");
Delay.msDelay(1850);
LCDPrinter.print("Takeoff!");
arb.start();