Package lejos.hardware.sensor
Class SumoEyesSensor
- java.lang.Object
-
- lejos.hardware.Device
-
- lejos.hardware.sensor.BaseSensor
-
- lejos.hardware.sensor.AnalogSensor
-
- lejos.hardware.sensor.SumoEyesSensor
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,SensorConstants,SensorMode,SensorModes,SampleProvider
public class SumoEyesSensor extends AnalogSensor implements SensorConstants
Java class for MINDSENSORS NXT SumoEyes (triple zone IR obstacle detector).- Version:
- 1.0
- Author:
- Daniele Benedettelli
-
-
Field Summary
Fields Modifier and Type Field Description static intCENTERThe Constant CENTER (2).static intLEFTThe Constant LEFT (1).static intNO_DETECTIONThe Constant NO_DETECTION (0).static intRIGHTThe Constant RIGHT (3).protected static longSWITCH_DELAY-
Fields inherited from class lejos.hardware.sensor.AnalogSensor
currentType, port
-
Fields inherited from class lejos.hardware.sensor.BaseSensor
currentMode, modes
-
Fields inherited from interface lejos.hardware.sensor.SensorConstants
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, BROWN, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_RAW, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HIGHSPEED, TYPE_HIGHSPEED_9V, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW
-
-
Constructor Summary
Constructors Constructor Description SumoEyesSensor(AnalogPort port)Default constructor.SumoEyesSensor(Port port)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetObstacle()Returns the detected zone (NO_DETECTION (0) , RIGHT (1), CENTER (2), LEFT (3))intgetValue()Gets the raw value of the sensor.booleanisLongRange()Returns the current range of the sensor.voidsetLongRange(boolean longRange)Enables long range of the sensor.-
Methods inherited from class lejos.hardware.sensor.AnalogSensor
normalize, NXTRawIntValue, NXTRawValue, switchType
-
Methods inherited from class lejos.hardware.sensor.BaseSensor
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
-
Methods inherited from class lejos.hardware.Device
close, releaseOnClose
-
-
-
-
Field Detail
-
SWITCH_DELAY
protected static final long SWITCH_DELAY
- See Also:
- Constant Field Values
-
NO_DETECTION
public static final int NO_DETECTION
The Constant NO_DETECTION (0).- See Also:
- Constant Field Values
-
LEFT
public static final int LEFT
The Constant LEFT (1).- See Also:
- Constant Field Values
-
CENTER
public static final int CENTER
The Constant CENTER (2).- See Also:
- Constant Field Values
-
RIGHT
public static final int RIGHT
The Constant RIGHT (3).- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SumoEyesSensor
public SumoEyesSensor(AnalogPort port)
Default constructor.- Parameters:
port- the sensor port
-
SumoEyesSensor
public SumoEyesSensor(Port port)
Default constructor.- Parameters:
port- the sensor port
-
-
Method Detail
-
getValue
public int getValue()
Gets the raw value of the sensor.- Returns:
- the raw sensor value
-
getObstacle
public int getObstacle()
Returns the detected zone (NO_DETECTION (0) , RIGHT (1), CENTER (2), LEFT (3))- Returns:
- detected zone constant
-
setLongRange
public void setLongRange(boolean longRange)
Enables long range of the sensor.- Parameters:
longRange- if true, enables long range, if false enables short range
-
isLongRange
public boolean isLongRange()
Returns the current range of the sensor.- Returns:
- current range of the sensor
-
-