Class LightDetectorAdaptor


  • public class LightDetectorAdaptor
    extends java.lang.Object
    Author:
    Roger Glassey
    • Constructor Summary

      Constructors 
      Constructor Description
      LightDetectorAdaptor​(SampleProvider sensor)
      allocates a LightSensorAdaptor ; sets mode to Ambient Accepts as a parameter one of EV3ColorSensor, NXTColorSensor, or NXTLightSensor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float getHigh()  
      float getLightValue()
      returns the raw light value using whatever mode has been set.
      float getLow()  
      java.lang.String getMode()  
      float getNormalizedLightValue()
      call setHigh() and setLow() before using this method.
      void setHigh​(float highValue)
      set the value that will return 1.0 from getNormalizedLightValue()
      void setLow​(float lowValue)
      set the value that will return 0.0 from getNormalizedLightValue()
      void setReflected​(boolean useReflected)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LightDetectorAdaptor

        public LightDetectorAdaptor​(SampleProvider sensor)
        allocates a LightSensorAdaptor ; sets mode to Ambient Accepts as a parameter one of EV3ColorSensor, NXTColorSensor, or NXTLightSensor
    • Method Detail

      • setReflected

        public void setReflected​(boolean useReflected)
        Parameters:
        useReflected - if true, reflected mode will be used; otherwise the ambient mode will be used;
      • getMode

        public java.lang.String getMode()
      • getLightValue

        public float getLightValue()
        returns the raw light value using whatever mode has been set.
      • getNormalizedLightValue

        public float getNormalizedLightValue()
        call setHigh() and setLow() before using this method. returns 0.0 when measured light value is low, 1.0 when it is high
        Returns:
        value between 0.0 and 1.0
      • setHigh

        public void setHigh​(float highValue)
        set the value that will return 1.0 from getNormalizedLightValue()
        Parameters:
        highValue -
      • getHigh

        public float getHigh()
      • setLow

        public void setLow​(float lowValue)
        set the value that will return 0.0 from getNormalizedLightValue()
        Parameters:
        lowValue -
      • getLow

        public float getLow()