X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=dsl%2Fruntime%2Fsrc%2Fnl%2Fru%2Fdes%2Fsensors%2FBTController.java;h=0f1ec0ff861d6c96e5032ffbf38c798ab0cab1e2;hb=8ac11d4775c780e307727b0e5dc865cf64517a59;hp=062fa617a530fb8d74f9dc7988d4158f9ed82222;hpb=476c651adb42cd9be8758e4f6ef2fe9ee2519fd5;p=des2015.git diff --git a/dsl/runtime/src/nl/ru/des/sensors/BTController.java b/dsl/runtime/src/nl/ru/des/sensors/BTController.java index 062fa61..0f1ec0f 100644 --- a/dsl/runtime/src/nl/ru/des/sensors/BTController.java +++ b/dsl/runtime/src/nl/ru/des/sensors/BTController.java @@ -9,7 +9,6 @@ import java.util.Queue; import lejos.hardware.Button; import lejos.remote.nxt.BTConnector; import lejos.remote.nxt.NXTConnection; -import nl.ru.des.LCDPrinter; public class BTController{ public static Queue buf; @@ -19,11 +18,11 @@ public class BTController{ private static BTConnector btconnector; public static void startMaster(final String slave, final MessageHandler sh) { - LCDPrinter.print("Start BT... Press any key to commence"); + System.out.println("Start BT... Press any key to commence"); Button.waitForAnyEvent(); btconnector = new BTConnector(); while(conn == null){ - LCDPrinter.print("Connecting to " + slave); + System.out.println("Connecting to " + slave); conn = btconnector.connect(slave, NXTConnection.RAW); } dataOut = conn.openDataOutputStream(); @@ -50,11 +49,11 @@ public class BTController{ } public static void startSlave() { - LCDPrinter.print("Start BT... Press any key to commence"); + System.out.println("Start BT... Press any key to commence"); Button.waitForAnyEvent(); btconnector = new BTConnector(); while(conn == null){ - LCDPrinter.print("Waiting for the master..."); + System.out.println("Waiting for the master..."); conn = btconnector.waitForConnection(60000, NXTConnection.RAW); } dataIn = conn.openDataInputStream(); @@ -67,8 +66,9 @@ public class BTController{ try { dataOut.write(buf.poll().getBytes()); dataOut.flush(); - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); + System.exit(0); } } Thread.yield();