public class LightSensor
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
LS_FRONT_LEFT
Constant for id of left front sensor
|
static int |
LS_FRONT_RIGHT
Constant for id of right front sensor
|
static int |
LS_REAR_LEFT
Constant for id of left rear sensor
|
static int |
LS_REAR_RIGHT
Constant for id of right rear sensor
|
| Constructor and Description |
|---|
LightSensor(int id)
Creates a light sensor instance with given id.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLightListener(LightListener lightListener)
Registers the given light listener with default trigger level 500.
|
void |
addLightListener(LightListener lightListener,
int triggerLevel)
Registers the given light listener for the given trigger level.
|
int |
getValue()
Returns the current intensity value (0..255).
|
void |
setTriggerLevel(int level)
Sets a new trigger level.
|
public static int LS_FRONT_LEFT
public static int LS_FRONT_RIGHT
public static int LS_REAR_LEFT
public static int LS_REAR_RIGHT
public LightSensor(int id)
id - the LightSensor identifierpublic int getValue()
public void addLightListener(LightListener lightListener, int triggerLevel)
lightListener - the LightListener to get registeredtriggerLevel - the trigger level where the callback is triggeredpublic void addLightListener(LightListener lightListener)
lightListener - the LightListener to get registered.public void setTriggerLevel(int level)
level - the new level