lejos.nxt.addon
Class IRSeekerV2

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

public class IRSeekerV2
extends I2CSensor


Nested Class Summary
static class IRSeekerV2.Mode
           
 
Field Summary
static byte address
           
static float noAngle
           
 
Fields inherited from class lejos.nxt.I2CSensor
DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION
 
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
IRSeekerV2(I2CPort port, IRSeekerV2.Mode mode)
           
 
Method Summary
 float getAngle()
           
 float getAngle(boolean blocking)
          Returns the angle of the target (-180 to 180) or NaN.
 int getAverage(int id)
          Returns the average sensor reading (DC Only)
 int getDirection()
          Returns the direction of the target (1 to 9) or 0 if no target.
 int getSensorValue(int id)
          Returns value of sensor 1 - 5.
 int[] getSensorValues()
          Gets the values of each sensor, returning them in an array.
 boolean hasDirection()
           
 void setMode(IRSeekerV2.Mode mode)
          Set the mode of the sensor
 java.lang.String toString()
          Returns a string representation of the strengths
 
Methods inherited from class lejos.nxt.I2CSensor
fetchString, getAddress, getData, getData, getData, getId, getProductID, getVendorID, getVersion, sendData, sendData, sendData, setAddress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

address

public static final byte address
See Also:
Constant Field Values

noAngle

public static final float noAngle
See Also:
Constant Field Values
Constructor Detail

IRSeekerV2

public IRSeekerV2(I2CPort port,
                  IRSeekerV2.Mode mode)
Method Detail

setMode

public void setMode(IRSeekerV2.Mode mode)
Set the mode of the sensor


getDirection

public int getDirection()
Returns the direction of the target (1 to 9) or 0 if no target.

Returns:
direction

getAngle

public float getAngle(boolean blocking)
Returns the angle of the target (-180 to 180) or NaN.

Returns:
direction

getAngle

public float getAngle()

hasDirection

public boolean hasDirection()

getSensorValue

public int getSensorValue(int id)
Returns value of sensor 1 - 5.

Parameters:
id - The id of the sensor to read
Returns:
sensor value (0 to 255).

getSensorValues

public int[] getSensorValues()
Gets the values of each sensor, returning them in an array.

Returns:
Array of sensor values (0 to 255).

getAverage

public int getAverage(int id)
Returns the average sensor reading (DC Only)

Returns:
sensor value (0 to 255).

toString

public java.lang.String toString()
Returns a string representation of the strengths

Overrides:
toString in class java.lang.Object