|
|||||||||
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.LightSensor
public class LightSensor
Class that represents a light sensor.
Field Summary |
---|
Fields inherited from class ch.aplu.nxt.Part |
---|
robot |
Constructor Summary | |
---|---|
LightSensor()
Creates a sensor instance connected to port S1. |
|
LightSensor(SensorPort port)
Creates a sensor instance connected to the given port. |
Method Summary | |
---|---|
void |
activate(boolean enable)
Turns on/off the LED used for reflecting light back into the sensor. |
void |
addLightListener(LightListener lightListener,
int triggerLevel)
Registers the given light listener for the given trigger level. |
protected void |
cleanup()
|
int |
getValue()
Polls the sensor. |
protected void |
init()
|
protected void |
startLightThread()
|
protected void |
stopLightThread()
|
Methods inherited from class ch.aplu.nxt.Sensor |
---|
getPort, getPortId, getPortLabel, LSRead, LSWrite, readBooleanValue, readNormalizedValue, readRawValue, readScaledValue, setTypeAndMode |
Methods inherited from class ch.aplu.nxt.Part |
---|
setRobot |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LightSensor(SensorPort port)
port
- the port where the sensor is plugged-inpublic LightSensor()
Method Detail |
---|
protected void init()
init
in class Part
protected void cleanup()
cleanup
in class Part
public void addLightListener(LightListener lightListener, int triggerLevel)
lightListener
- the LightListener to become registered.triggerLevel
- the trigger level where the callback is triggeredprotected void startLightThread()
protected void stopLightThread()
public int getValue()
public void activate(boolean enable)
enable
- if true, turn the LED on, otherwise turn it off
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |