X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=dsl%2Fruntime%2Fsrc%2Fnl%2Fru%2Fdes%2FMarster.java;h=7074f5958e254cbdc56966c5f2c8add728d91c9b;hb=3e5a839d3f540c49d5b903bfebdd8913e7deef9a;hp=16dd328ed1c627270838329ca58d8d0ff82ed84d;hpb=8ac11d4775c780e307727b0e5dc865cf64517a59;p=des2015.git diff --git a/dsl/runtime/src/nl/ru/des/Marster.java b/dsl/runtime/src/nl/ru/des/Marster.java index 16dd328..7074f59 100644 --- a/dsl/runtime/src/nl/ru/des/Marster.java +++ b/dsl/runtime/src/nl/ru/des/Marster.java @@ -1,10 +1,10 @@ package nl.ru.des; +import java.io.File; import java.io.PrintStream; import java.util.LinkedList; import java.util.Random; -import lejos.hardware.Button; import lejos.hardware.Sound; import lejos.hardware.ev3.EV3; import lejos.hardware.ev3.LocalEV3; @@ -20,6 +20,7 @@ import lejos.hardware.sensor.EV3UltrasonicSensor; import lejos.hardware.sensor.NXTLightSensor; import lejos.robotics.RegulatedMotor; import lejos.robotics.SampleProvider; +import lejos.utility.Delay; import nl.ru.des.sensors.BTController; import nl.ru.des.sensors.RemoteSensors; import nl.ru.des.sensors.SensorCollector; @@ -28,6 +29,44 @@ public class Marster { public static Arbitrator arb; public static Random random; + public static void playPacman(){ + int whole = 2000; + Sound.playNote(Sound.PIANO, 494, whole/16);// b4 + Sound.playNote(Sound.PIANO, 988, whole/16);// b5 + Sound.playNote(Sound.PIANO, 740, whole/16);// f#5 + Sound.playNote(Sound.PIANO, 622, whole/16);// eb5 + Sound.playNote(Sound.PIANO, 988, whole/32);// b5 + Sound.playNote(Sound.PIANO, 740, whole/16+whole/32);// f#5 + Sound.playNote(Sound.PIANO, 622, whole/8);// eb5 + + Sound.playNote(Sound.PIANO, 523, whole/16);// c5 + Sound.playNote(Sound.PIANO, 1047, whole/16);// c6 + Sound.playNote(Sound.PIANO, 784, whole/16);// g5 + Sound.playNote(Sound.PIANO, 659, whole/16);// e5 + Sound.playNote(Sound.PIANO, 1047, whole/32);// c6 + Sound.playNote(Sound.PIANO, 784, whole/16+whole/32);// g5 + Sound.playNote(Sound.PIANO, 659, whole/8);// e5 + + Sound.playNote(Sound.PIANO, 494, whole/16);// b4 + Sound.playNote(Sound.PIANO, 988, whole/16);// b5 + Sound.playNote(Sound.PIANO, 740, whole/16);// f#5 + Sound.playNote(Sound.PIANO, 622, whole/16);// eb5 + Sound.playNote(Sound.PIANO, 988, whole/32);// b5 + Sound.playNote(Sound.PIANO, 740, whole/16+whole/32);// f#5 + Sound.playNote(Sound.PIANO, 622, whole/8);// eb5 + + Sound.playNote(Sound.PIANO, 622, whole/32);// eb5 + Sound.playNote(Sound.PIANO, 659, whole/32);// e5 + Sound.playNote(Sound.PIANO, 698, whole/16);// f5 + Sound.playNote(Sound.PIANO, 698, whole/32);// f5 + Sound.playNote(Sound.PIANO, 740, whole/32);// f#5 + Sound.playNote(Sound.PIANO, 784, whole/16);// g5 + Sound.playNote(Sound.PIANO, 784, whole/32);// g5 + Sound.playNote(Sound.PIANO, 831, whole/32);// ab5 + Sound.playNote(Sound.PIANO, 880, whole/16);// a5 + Sound.playNote(Sound.PIANO, 988, whole/8);// b5 + } + @SuppressWarnings("resource") public static void main(String[] args) { EV3 brick = LocalEV3.get(); @@ -37,7 +76,6 @@ public class Marster { System.out.println("Loading keylistener..."); brick.getKey("Escape").addKeyListener(new ButtonListener()); - if(brick.getName().equalsIgnoreCase("Rover6") || brick.getName().equalsIgnoreCase("Rover8")){ System.out.println("Starting as a slave..."); System.out.println("My name is " + brick.getName()); @@ -89,16 +127,19 @@ public class Marster { sc.calibrate(); LinkedList missions = Missions.getMissions(sc, rightMotor, leftMotor, measMotor); random = new Random(); - System.out.println("Press any button to start"); - Button.waitForAnyEvent(); + Delay.msDelay(2000); + playPacman(); for(Mission m : missions){ System.out.println("Start " + m.name + " mission..."); arb = new Arbitrator(m.behaviours); sc.reset(); arb.start(); Sound.buzz(); + Delay.msDelay(5000); System.out.println(m.name + " finished!!1one!"); } + Sound.playSample(new File("rick.wav"), Sound.VOL_MAX); + Delay.msDelay(10000); System.exit(0); } }