Package lejos.hardware.device
Class SensorMux
- java.lang.Object
-
- lejos.hardware.Device
-
- lejos.hardware.sensor.BaseSensor
-
- lejos.hardware.sensor.I2CSensor
-
- lejos.hardware.device.SensorMux
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,SensorConstants,SensorMode,SensorModes,SampleProvider
public class SensorMux extends I2CSensor
- Author:
- 3DGamer (LeJOS Forum User), Juan Antonio Brenha Moral, Xander Soldaat
-
-
Field Summary
-
Fields inherited from class lejos.hardware.sensor.I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigurate()This method is necessary to execute to connect sensors on itintgetDistance(int channel)Method used to use a US with the sensor and get the distancesintgetType()Return the typebooleanisBatteryLow()Method used to get if battery status is low.intisPressed(int channel)Method used to manage a Touch SensorintreadValue(int channel)Method used to receive data from a Sound Sensor-
Methods inherited from class lejos.hardware.sensor.I2CSensor
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
-
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
-
-
-
-
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
-
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
-
-