|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlejos.nxt.SensorPort.SensorReader
lejos.nxt.SensorPort.ColorSensorReader
protected class SensorPort.ColorSensorReader
Lego Color Sensor driver. This driver provides access to the Lego Color sensor. It allows the reading raw and processed color values. The sensor has a tri-color led and this can be set to output red/green/blue or off. It also has a full mode in which four samples are read (off/red/green/blue) very quickly. These samples can then be combined using the calibration data provided by the device to determine the "Lego" color currently being viewed.
Constructor Summary | |
---|---|
SensorPort.ColorSensorReader()
Create a new Color Sensor instance and bind it to a port. |
Method Summary | |
---|---|
int |
readRawValue()
Return a single raw value from the device. |
int |
readRawValues(int[] vals)
When in full color mode this returns all four raw color values from the device by doing four very quick reads and flashing all colors. |
int |
readValue()
Return a single processed value. |
int |
readValues(int[] vals)
Return a set of calibrated data. |
void |
reset()
Reset the sensor. |
void |
setType(int type)
Change the type of the sensor |
Methods inherited from class lejos.nxt.SensorPort.SensorReader |
---|
setMode |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SensorPort.ColorSensorReader()
Method Detail |
---|
public void setType(int type)
setType
in class SensorPort.SensorReader
type
- new sensor type.public void reset()
reset
in class SensorPort.SensorReader
public int readRawValue()
readRawValue
in class SensorPort.SensorReader
public int readRawValues(int[] vals)
vals[ColorSensor.RGB_BLUE]
readRawValues
in class SensorPort.SensorReader
vals
- array of four color values.
public int readValues(int[] vals)
vals[ColorSensor.BLUE_INDEX]
readValues
in class SensorPort.SensorReader
vals
- 4 element array for the results
public int readValue()
readValue
in class SensorPort.SensorReader
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |