|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlejos.nxt.SensorPort
public class SensorPort
Abstraction for a NXT input port.
Field Summary | |
---|---|
static SensorPort[] |
PORTS
Array containing all three ports [0..3]. |
static SensorPort |
S1
Port labeled 1 on NXT. |
static SensorPort |
S2
Port labeled 2 on NXT. |
static SensorPort |
S3
Port labeled 3 on NXT. |
static SensorPort |
S4
Port labeled 4 on NXT. |
Fields inherited from interface lejos.nxt.SensorConstants |
---|
MODE_ANGLESTEP, MODE_BOOLEAN, MODE_CELSIUS, MODE_FARENHEIT, MODE_PCTFULLSCALE, MODE_PERIODCOUNTER, MODE_RAW, MODE_TRANSITIONCNT, TYPE_ANGLE, TYPE_CUSTOM, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE |
Method Summary | |
---|---|
void |
activate()
Activates an RCX sensor. |
void |
addSensorPortListener(SensorPortListener aListener)
Adds a port listener. |
void |
callListeners()
Call Port Listeners. |
int |
getId()
Return the ID of the port. |
int |
getMode()
Returns mode compatible with Lego firmware. |
int |
getType()
Returns type compatible with Lego firmware. |
int |
i2cBusy()
Low-level method to test if I2C connection is busy. |
static int |
i2cBusyById(int aPortId)
Low-level method to test if I2C connection is busy. |
void |
i2cDisable()
Low-level method to disable I2C on the port. |
static void |
i2cDisableById(int aPortId)
Low-level method to disable I2C on the port. |
void |
i2cEnable()
Low-level method to enable I2C on the port. |
static void |
i2cEnableById(int aPortId)
Low-level method to enable I2C on the port. |
int |
i2cStart(int address,
int internalAddress,
int numInternalBytes,
byte[] buffer,
int numBytes,
int transferType)
Low-level method to start an I2C transaction. |
static int |
i2cStartById(int aPortId,
int address,
int internalAddress,
int numInternalBytes,
byte[] buffer,
int numBytes,
int transferType)
Low-level method to start an I2C transaction. |
void |
passivate()
Passivates an RCX sensor sensor. |
boolean |
readBooleanValue()
Reads the boolean value of the sensor. |
int |
readRawValue()
Reads the raw value of the sensor. |
int |
readValue()
Returns value compatible with Lego firmware. |
void |
setMode(int mode)
Sets mode compatible with Lego firmware. |
void |
setType(int type)
Sets type compatible with Lego firmware. |
void |
setTypeAndMode(int type,
int mode)
Sets type and mode compatible with Lego firmware. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait |
Field Detail |
---|
public static final SensorPort S1
public static final SensorPort S2
public static final SensorPort S3
public static final SensorPort S4
public static final SensorPort[] PORTS
Method Detail |
---|
public final int readRawValue()
readRawValue
in interface ADSensorPort
public final boolean readBooleanValue()
readBooleanValue
in interface ADSensorPort
public final int getId()
public void addSensorPortListener(SensorPortListener aListener)
NOTE 1: You can add at most 8 listeners.
NOTE 2: Synchronizing inside listener methods could result
in a deadlock.
SensorPortListener
public final void activate()
activate
in interface LegacySensorPort
public final void passivate()
passivate
in interface LegacySensorPort
public int getMode()
getMode
in interface BasicSensorPort
public int getType()
getType
in interface BasicSensorPort
public void setTypeAndMode(int type, int mode)
setTypeAndMode
in interface BasicSensorPort
public void setType(int type)
setType
in interface BasicSensorPort
public void setMode(int mode)
setMode
in interface BasicSensorPort
public int readValue()
readValue
in interface ADSensorPort
public void callListeners()
callListeners
in interface ListenerCaller
public static void i2cEnableById(int aPortId)
public static void i2cDisableById(int aPortId)
public static int i2cBusyById(int aPortId)
public static int i2cStartById(int aPortId, int address, int internalAddress, int numInternalBytes, byte[] buffer, int numBytes, int transferType)
public void i2cEnable()
i2cEnable
in interface I2CPort
public void i2cDisable()
i2cDisable
in interface I2CPort
public int i2cBusy()
i2cBusy
in interface I2CPort
public int i2cStart(int address, int internalAddress, int numInternalBytes, byte[] buffer, int numBytes, int transferType)
i2cStart
in interface I2CPort
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |