public class EV3ColorSensor extends BaseSensor
Sensor configuration
The flood light of the sensors can be put on or off using the setFloodlight methods.
See Sensor Product page
See The
leJOS sensors framework
See leJOS conventions for
SampleProviders
Modifier and Type | Class and Description |
---|---|
private class |
EV3ColorSensor.AmbientMode |
private class |
EV3ColorSensor.ColorIDMode |
private class |
EV3ColorSensor.RedMode |
private class |
EV3ColorSensor.RGBMode |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
COL_AMBIENT |
protected static java.lang.String |
COL_CAL |
private static java.lang.String |
COL_COLOR |
private static java.lang.String |
COL_REFLECT |
protected static java.lang.String |
COL_REFRAW |
private static java.lang.String |
COL_RESET |
private static java.lang.String |
COL_RGBRAW |
protected static int[] |
colorMap |
private static java.lang.String |
LEGO_EV3_COLOR_SENSOR |
private static int[] |
lightColor |
protected short[] |
raw |
currentMode, currentModeS, modes, SWITCH_DELAY
LEGO_ANALOG_SENSOR, LEGO_UART_SENSOR, SENSOR_MODE, SENSOR_MODES
ADDRESS, DEVICE, LEGO_PORT, LEGO_SENSOR, MODE, PATH_DEVICE
DEVICE_ROOT_PATH
BRICKPI, EV3BRICK, PISTORMS
Constructor and Description |
---|
EV3ColorSensor(java.lang.String portName) |
Modifier and Type | Method and Description |
---|---|
SensorMode |
getAmbientMode()
EV3 color sensors, Ambient mode
Measures the level of ambient light while the sensors lights are off. |
int |
getColorID() |
SensorMode |
getColorIDMode()
EV3 color sensors, Color ID mode
Measures the color ID of a surface. |
int |
getFloodlight() |
SensorMode |
getRedMode()
EV3 color sensors, Red mode
Measures the level of reflected light from the sensors RED LED. |
SensorMode |
getRGBMode()
EV3 color sensors, RGB mode
Measures the level of red, green and blue light when illuminated by a white light source.. |
private void |
initModes() |
boolean |
isFloodlightOn() |
void |
setFloodlight(boolean floodlight) |
boolean |
setFloodlight(int color) |
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes, switchMode, switchMode
detect, getIntegerAttribute, getStringAttribute, setIntegerAttribute, setStringAttribute
getMotorPort, getPlatform, getSensorPort
protected static int[] colorMap
private static final java.lang.String LEGO_EV3_COLOR_SENSOR
private static final java.lang.String COL_RESET
private static final java.lang.String COL_REFLECT
private static final java.lang.String COL_AMBIENT
private static final java.lang.String COL_COLOR
protected static final java.lang.String COL_REFRAW
private static final java.lang.String COL_RGBRAW
protected static final java.lang.String COL_CAL
private static final int[] lightColor
protected short[] raw
private void initModes()
public int getColorID()
public void setFloodlight(boolean floodlight)
public boolean isFloodlightOn()
public int getFloodlight()
public boolean setFloodlight(int color)
public SensorMode getColorIDMode()
Size and content of the sample
The sample contains one element containing the ID (0-7) of the detected color.
leJOS conventions for
SampleProviders
public SensorMode getRedMode()
Size and content of the sample
The sample contains one element containing the intensity level (Normalized between 0 and 1) of reflected light.
leJOS conventions for
SampleProviders
public SensorMode getAmbientMode()
Size and content of the sample
The sample contains one element containing the intensity level (Normalized between 0 and 1) of ambient light.
leJOS conventions for
SampleProviders
public SensorMode getRGBMode()
Size and content of the sample
The sample contains 3 elements containing the intensity level (Normalized between 0 and 1) of red, green and blue light respectivily.
leJOS conventions for
SampleProviders