Minor bugfixes when quitting.

This commit is contained in:
2014-04-01 16:00:55 -04:30
parent 0ebcbb3ce3
commit c4662c2127

View File

@@ -49,9 +49,13 @@ public class NxtAR_bot{
} }
bluetoothConnection.close(); bluetoothConnection.close();
} }
System.exit(0);
} }
public static void main(String[] args){ public static void main(String[] args){
Button.ESCAPE.addButtonListener(new QuitButtonListener());
Motor.A.resetTachoCount(); Motor.A.resetTachoCount();
Motor.B.resetTachoCount(); Motor.B.resetTachoCount();
Motor.C.resetTachoCount(); Motor.C.resetTachoCount();
@@ -59,18 +63,16 @@ public class NxtAR_bot{
LightSensor lightSensor = new LightSensor(SensorPort.S1); LightSensor lightSensor = new LightSensor(SensorPort.S1);
lightSensor.setFloodlight(false); lightSensor.setFloodlight(false);
System.out.println("Point at dark and press ENTER"); System.out.println("Point at dark\nand press ENTER");
Button.ENTER.waitForPress(); Button.ENTER.waitForPress();
lightSensor.calibrateLow(); lightSensor.calibrateLow();
System.out.println("--/--"); System.out.println("--/--");
System.out.println("Point at light and press ENTER"); System.out.println("Point at light\nand press ENTER");
Button.ENTER.waitForPress(); Button.ENTER.waitForPress();
lightSensor.calibrateHigh(); lightSensor.calibrateHigh();
System.out.println("--/--"); System.out.println("--/--");
Button.ESCAPE.addButtonListener(new QuitButtonListener());
bluetoothConnection = Bluetooth.waitForConnection(); bluetoothConnection = Bluetooth.waitForConnection();
bluetoothConnection.setIOMode(NXTConnection.RAW); bluetoothConnection.setIOMode(NXTConnection.RAW);
dataOutputStream = bluetoothConnection.openDataOutputStream(); dataOutputStream = bluetoothConnection.openDataOutputStream();