X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=nxtOSEK%2Flejos_nxj%2Fsrc%2Fjava%2Fclasses%2Flejos%2Fnxt%2FLightSensor.java;fp=nxtOSEK%2Flejos_nxj%2Fsrc%2Fjava%2Fclasses%2Flejos%2Fnxt%2FLightSensor.java;h=d7a1214653b5ae3eeb10d174c18f6c0375d0c9c0;hb=02b55ed885bb3a3127d172ffe12a89eef34ef839;hp=3269dc87da1f57c65e320dc339b7c5bf25e1d06d;hpb=815664f1648545c25bb41fd4c99117bf488c7735;p=nxt-jsp%2Flejos_nxj.git diff --git a/nxtOSEK/lejos_nxj/src/java/classes/lejos/nxt/LightSensor.java b/nxtOSEK/lejos_nxj/src/java/classes/lejos/nxt/LightSensor.java index 3269dc8..d7a1214 100644 --- a/nxtOSEK/lejos_nxj/src/java/classes/lejos/nxt/LightSensor.java +++ b/nxtOSEK/lejos_nxj/src/java/classes/lejos/nxt/LightSensor.java @@ -34,9 +34,7 @@ public class LightSensor implements SensorConstants port.setTypeAndMode( (floodlight ? TYPE_LIGHT_ACTIVE : TYPE_LIGHT_INACTIVE), - MODE_PCTFULLSCALE); - - + MODE_PCTFULLSCALE); } /** @@ -84,4 +82,22 @@ public class LightSensor implements SensorConstants { _hundred = port.readRawValue(); } + /** + * set the normalized value corresponding to readValue() = 0 + * @param low the low value + */ + public void setLow(int low) { _zero = 1023 - low;} + /** + * set the normalized value corresponding to readValue() = 100; + * @param high the high value + */ + public void setHigh(int high) { _hundred = 1023 - high;} + /** + * return the normalized value corresponding to readValue() = 0 + */ + public int getLow() { return 1023 - _zero;} + /** + * return the normalized value corresponding to readValue() = 100; + */ + public int getHigh() {return 1023 - _hundred;} }