OSDN Git Service

lejos_NXJ_win32_0_6_0beta.zip
[nxt-jsp/lejos_nxj.git] / nxtOSEK / lejos_nxj / src / java / classes / lejos / nxt / LightSensor.java
index 3269dc8..d7a1214 100644 (file)
@@ -34,9 +34,7 @@ public class LightSensor implements SensorConstants
        port.setTypeAndMode(\r
                   (floodlight ? TYPE_LIGHT_ACTIVE\r
                                       : TYPE_LIGHT_INACTIVE),\r
-                  MODE_PCTFULLSCALE);\r
-                       \r
-          \r
+                  MODE_PCTFULLSCALE); \r
        }\r
        \r
        /**\r
@@ -84,4 +82,22 @@ public class LightSensor implements SensorConstants
        {\r
                _hundred = port.readRawValue();\r
        }\r
+       /** \r
+        * set the normalized value corresponding to readValue() = 0\r
+        * @param low the low value\r
+        */\r
+       public void setLow(int low) { _zero = 1023 - low;}\r
+         /** \r
+     * set the normalized value corresponding to  readValue() = 100;\r
+     * @param high the high value\r
+     */\r
+    public void setHigh(int high) { _hundred = 1023 - high;}\r
+    /**\r
+    * return  the normalized value corresponding to readValue() = 0\r
+    */\r
+   public int getLow() { return 1023 - _zero;}\r
+    /** \r
+    * return the normalized value corresponding to  readValue() = 100;\r
+    */\r
+   public int  getHigh() {return 1023 - _hundred;}\r
 }\r