lejos.nxt.addon
Class SensorMux

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

public class SensorMux
extends I2CSensor

Author:
3DGamer (LeJOS Forum User), Juan Antonio Brenha Moral, Xander Soldaat

Field Summary
 
Fields inherited from class lejos.nxt.I2CSensor
address, 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
SensorMux(I2CPort port)
          Constructor
 
Method Summary
 void configurate()
          This method is necessary to execute to connect sensors on it
 int getDistance(int channel)
          Method used to use a US with the sensor and get the distances
 String getProductID()
          Method used to know the type of the sensor
 int getType()
          Return the type
 String getVendorID()
          Method used to know the Product ID
 String getVersion()
          Method used to know the version
 boolean isBatteryLow()
          Method used to get if battery status is low.
 int isPressed(int channel)
          Method used to manage a Touch Sensor
 int readValue(int channel)
          Method used to receive data from a Sound Sensor
 
Methods inherited from class lejos.nxt.I2CSensor
fetchString, getAddress, getData, getData, getPort, sendData, sendData, sendData, setAddress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SensorMux

public SensorMux(I2CPort port)
Constructor

Parameters:
port - the port
Method Detail

getType

public int getType()
Return the type

Returns:
the type

isBatteryLow

public boolean isBatteryLow()
Method used to get if battery status is low.

Returns:
true if the battery is low, else false

getVendorID

public String getVendorID()
Method used to know the Product ID

Overrides:
getVendorID in class I2CSensor
Returns:
vendor identifier

getProductID

public String getProductID()
Method used to know the type of the sensor

Overrides:
getProductID in class I2CSensor
Returns:
product identifier

getVersion

public String getVersion()
Method used to know the version

Overrides:
getVersion in class I2CSensor
Returns:
version number

configurate

public void configurate()
This method is necessary to execute to connect sensors on it


getDistance

public int getDistance(int channel)
Method used to use a US with the sensor and get the distances

Parameters:
channel - the index of the channel
Returns:
the distance

isPressed

public int isPressed(int channel)
Method used to manage a Touch Sensor

Parameters:
channel - the index of the channel
Returns:
true if the sensor is presed, else false

readValue

public int readValue(int channel)
Method used to receive data from a Sound Sensor

Parameters:
channel - the index of the channel
Returns:
the value