lejos.nxt.addon
Class SumoEyesSensor

java.lang.Object
  extended by lejos.nxt.addon.SumoEyesSensor
All Implemented Interfaces:
SensorConstants

public class SumoEyesSensor
extends java.lang.Object
implements SensorConstants

Java class for MINDSENSORS NXT SumoEyes (triple zone IR obstacle detector).

Version:
1.0
Author:
Daniele Benedettelli

Field Summary
static int CENTER
          The Constant CENTER (2).
static int LEFT
          The Constant LEFT (1).
static int NO_DETECTION
          The Constant NO_DETECTION (0).
static int RIGHT
          The Constant RIGHT (3).
 
Fields inherited from interface lejos.nxt.SensorConstants
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, GREEN, GREEN_INDEX, MAX_AD_RAW, MAX_TYPE, MIN_TYPE, MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, 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
SumoEyesSensor(ADSensorPort port)
          Default constructor.
SumoEyesSensor(ADSensorPort port, boolean longRange)
          Constructor with range specification.
 
Method Summary
 int getObstacle()
          Returns the detected zone (NO_DETECTION (0) , RIGHT (1), CENTER (2), LEFT (3))
 int getValue()
          Gets the raw value of the sensor.
 boolean isLongRange()
          Returns the current range of the sensor.
 void setLongRange(boolean longRange)
          Enables long range of the sensor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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(ADSensorPort port)
Default constructor.

Parameters:
port - the sensor port

SumoEyesSensor

public SumoEyesSensor(ADSensorPort port,
                      boolean longRange)
Constructor with range specification.

Parameters:
port - the sensor port
longRange - if true, enables long range
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