package RCX2; import josx.platform.rcx.*; /** *A listener for the light sensor. Tells CapnKirk light() or dark(). */ public class LightListener implements SensorListener { public void stateChanged(Sensor aSource, int aOldValue, int aNewValue){ if (Sensor.S1.readValue() >= Sensors.SVwhite-Sensors.SVlightTolerance){ Navigator.white = true; CapnKirk.lit(true); }else if (Sensor.S1.readValue() <= Sensors.SVblack+Sensors.SVlightTolerance){ Navigator.white = false; CapnKirk.lit(false); } }//stateChanged }//LightListener