Package lejos.robotics
Class LightDetectorAdaptor
- java.lang.Object
-
- lejos.robotics.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 floatgetHigh()floatgetLightValue()returns the raw light value using whatever mode has been set.floatgetLow()java.lang.StringgetMode()floatgetNormalizedLightValue()call setHigh() and setLow() before using this method.voidsetHigh(float highValue)set the value that will return 1.0 from getNormalizedLightValue()voidsetLow(float lowValue)set the value that will return 0.0 from getNormalizedLightValue()voidsetReflected(boolean useReflected)
-
-
-
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()
-
-