|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.addon.RCXLightSensor
public class RCXLightSensor
This class is used to obtain readings from a legacy RCX light sensor, using an adapter cable to connect it to the NXT brick. The light sensor can be calibrated to low and high values. Note: The RCX light sensor is not very sensitive when the floodlight is turned off: Dark is around 523, sunlight is around 634. When the floodlight is on, dark readings are around 155 and sunlight is around 713.
Field Summary |
---|
Constructor Summary | |
---|---|
RCXLightSensor(LegacySensorPort port)
Create an RCX light sensor object attached to the specified port. |
Method Summary | |
---|---|
void |
activate()
Deprecated. Use setFloodlight(boolean) with true instead |
void |
calibrateHigh()
call this method when the light sensor is reading the high value - used by readValue |
void |
calibrateLow()
call this method when the light sensor is reading the low value - used by readValue |
Colors.Color |
getFloodlight()
Returns the color of the floodlight, including Color.NONE. |
int |
getHigh()
The highest raw light value this sensor can return from intense bright light. |
int |
getLightValue()
Returns the calibrated and normalized brightness of the white light detected. |
int |
getLow()
The lowest raw light value this sensor can return in pitch black darkness. |
int |
getNormalizedLightValue()
Returns the normalized value of the brightness of the white light detected, such that the lowest value is darkness and the highest value is intense bright light. |
boolean |
isFloodlightOn()
Checks if the floodlight is currently on. |
void |
passivate()
Deprecated. Use setFloodlight(boolean) with false instead |
int |
readValue()
Deprecated. Use getLightValue() instead |
void |
setFloodlight(boolean floodlight)
Turns the default LED light on or off. |
boolean |
setFloodlight(Colors.Color color)
Used to turn on or off the floodlight by color. |
void |
setHigh(int high)
set the normalized value corresponding to readValue() = 100; |
void |
setLow(int low)
set the normalized value corresponding to readValue() = 0 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RCXLightSensor(LegacySensorPort port)
port
- port, e.g. Port.S1Method Detail |
---|
public void activate()
setFloodlight(boolean)
with true instead
public void passivate()
setFloodlight(boolean)
with false instead
public int readValue()
getLightValue()
instead
public Colors.Color getFloodlight()
LampLightDetector
getFloodlight
in interface LampLightDetector
public boolean isFloodlightOn()
LampLightDetector
isFloodlightOn
in interface LampLightDetector
public void setFloodlight(boolean floodlight)
LampLightDetector
setFloodlight
in interface LampLightDetector
floodlight
- true to turn on lamp, false for off (ambient light only).public boolean setFloodlight(Colors.Color color)
LampLightDetector
setFloodlight
in interface LampLightDetector
color
- Use lejos.robotics.Color
enumeration constant to control lamp colors.
public int getLightValue()
LightDetector
getLightValue
in interface LightDetector
public int getNormalizedLightValue()
LightDetector
getNormalizedLightValue
in interface LightDetector
public void calibrateLow()
public void calibrateHigh()
public void setLow(int low)
low
- the low valuepublic void setHigh(int high)
high
- the high valuepublic int getLow()
LightDetector
getLow
in interface LightDetector
public int getHigh()
LightDetector
getHigh
in interface LightDetector
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |