|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.aplu.nxt.Part ch.aplu.nxt.Sensor ch.aplu.nxt.ColorSensor
public class ColorSensor
Class that represents a color light sensor (Lego Color Sensor)
Field Summary |
---|
Constructor Summary | |
---|---|
ColorSensor()
Creates a sensor instance connected to port S1. |
|
ColorSensor(SensorPort port)
Creates a sensor instance connected to the given port. |
Method Summary | |
---|---|
lejos.robotics.Color |
getColor()
Returns a lejos.robotics.Color reference to the the calibrated color reading. |
lejos.nxt.SensorPort |
getLejosPort()
Returns the reference of the the underlying lejos.nxt.SensorPort. |
lejos.nxt.ColorSensor |
getLejosSensor()
Returns the reference of the the underlying lejos.nxt.ColorSensor. |
int |
getLightValue()
Returns the intensity of the detected light. |
boolean |
inColorCube(lejos.robotics.Color color,
int[] colorCube)
Checks if given color lies within given color cube. |
void |
setFloodlight(int color)
Turns the red, green or blue LED on or off. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ColorSensor(SensorPort port)
port
- the port where the sensor is plugged-inpublic ColorSensor()
Method Detail |
---|
public lejos.nxt.ColorSensor getLejosSensor()
public lejos.nxt.SensorPort getLejosPort()
public boolean inColorCube(lejos.robotics.Color color, int[] colorCube)
color
- a lejos.nxt.robotics.Color referencecolorCube
- an integer array of 6 boundary values in the order:
red_min, red_max, green_min, green_max, blue_min, blue_max
public lejos.robotics.Color getColor()
public int getLightValue()
public void setFloodlight(int color)
color
- one of the color enumerations Color.RED, Color.GREEN, Color.BLUE, Color.NONE (turn off)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |