public class HiTechnicColorSensor extends I2CSensor implements ColorIdentifier
The code for this sensor has not been tested. Please report test results to the leJOS forum.
Supported modes | |||
---|---|---|---|
Mode name | Description | unit(s) | Getter |
Color ID | Measures the color ID of a surface | Color ID | getColorIDMode() |
RGB | Measures the RGB color of a surface | N/A, Normalized to (0-1) | getRGBMode() |
See
Sensor Product page
See The
leJOS sensor framework
See leJOS conventions for
SampleProviders
Modifier and Type | Class and Description |
---|---|
class |
HiTechnicColorSensor.RGBMode |
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
currentMode, modes
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 and Description |
---|
HiTechnicColorSensor(I2CPort port) |
HiTechnicColorSensor(Port port) |
Modifier and Type | Method and Description |
---|---|
int |
getColorID()
Returns the color index detected by the sensor.
|
SensorMode |
getColorIDMode()
HiTechnic color sensor, Color ID mode
Measures the color ID of a surface. |
SensorMode |
getRGBMode()
HiTechnic color sensor, Color ID mode
Measures the color of a surface. |
protected void |
init() |
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
close, releaseOnClose
public HiTechnicColorSensor(I2CPort port)
public HiTechnicColorSensor(Port port)
protected void init()
public int getColorID()
getColorID
in interface ColorIdentifier
public SensorMode getColorIDMode()
Size and content of the sample
The sample contains one element containing a color ID.
public SensorMode getRGBMode()
Size and content of the sample
The sample contains three elements containing the color expressed in RGB values (0-255) of the measured surface.