public class NxtColorSensor extends Sensor
Constructor and Description |
---|
NxtColorSensor()
Creates a sensor instance connected to port S1.
|
NxtColorSensor(SensorPort port)
Creates a sensor instance connected to the given port.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
getColor()
Polls the sensor.
|
int |
getColorInt()
Polls the sensor.
|
int |
getLightValue()
Returns the intensity of the detected light.
|
static boolean |
inColorCube(java.awt.Color 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 NxtColorSensor(SensorPort port)
port
- the port where the sensor is plugged-inpublic NxtColorSensor()
public java.awt.Color getColor()
public int getColorInt()
public int getLightValue()
public void setFloodlight(int colorValue)
colorValue
- 0: red, 1: green, 2: blue, -1: all offpublic static boolean inColorCube(java.awt.Color 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_max