public class ColorSensor extends Sensor
| Modifier and Type | Field and Description | 
|---|---|
static int[][] | 
colorCubes
Color cubes for detecting color labels.
 6 user adaptable int arrays with red_min, red_max, green_min, green_max, blue_min, blue_max
 for the colors Black, Blue, Green, Yellow, Red, White. 
 | 
| Constructor and Description | 
|---|
ColorSensor()
Creates a sensor instance connected to port S1. 
 | 
ColorSensor(SensorPort port)
Creates a sensor instance connected to the given port. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
int | 
getColor()
Polls the sensor. 
 | 
int | 
getColorID()
Returns a integer number ID for the current color reading. 
 | 
ColorLabel | 
getColorLabel()
Returns one of the enums of ColorLabel. 
 | 
static boolean | 
inColorCube(int color,
           int[] colorCube)
Checks if given color lies within given color cube. 
 | 
void | 
setFloodlight(int colorValue)
Turns the red, green or blue LED on or all off. 
 | 
public static int[][] colorCubes
 ColorSensor.colorCubes[1] = new int[]{0, 2, 0, 2, 0, 2};
public ColorSensor(SensorPort port)
port - the port where the sensor is plugged-inpublic ColorSensor()
public int getColor()
public int getColorID()
public ColorLabel getColorLabel()
public static boolean inColorCube(int color,
                  int[] colorCube)
color - the color to checkcolorCube - an integer array of 6 boundary values in the order:
 red_min, red_max, green_min, green_max, blue_min, blue_maxpublic void setFloodlight(int colorValue)
colorValue - 0: red, 1: green, 2: blue, -1: all off