|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lejos.nxt.comm.NXTCommand
public class NXTCommand
Remote access to a NXT via Bluetooth using LCP.
Field Summary |
---|
Constructor Summary | |
---|---|
NXTCommand()
|
Method Summary | |
---|---|
void |
close()
Call the close() command when your program ends, otherwise you will have to turn the NXT brick off/on before you run another program using iCommand. |
byte |
deleteUserFlash()
Deletes user flash memory (not including system modules). |
int |
getBatteryLevel()
|
DeviceInfo |
getDeviceInfo()
|
FirmwareInfo |
getFirmwareVersion()
|
InputValues |
getInputValues(int port)
|
int |
getTachoCount(int port)
Retrieves tacho count. |
void |
open(String name)
|
byte |
playTone(int frequency,
int duration)
Plays a tone on NXT speaker. |
byte |
resetMotorPosition(int port,
boolean relative)
Resets the tachometer |
byte |
setInputMode(int port,
int sensorType,
int sensorMode)
Tells the NXT what type of sensor you are using and the mode to operate in. |
byte |
setOutputState(int port,
byte power,
int mode,
int regulationMode,
int turnRatio,
int runState,
int tachoLimit)
|
void |
setVerify(boolean verify)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait |
Constructor Detail |
---|
public NXTCommand()
Method Detail |
---|
public void open(String name) throws IOException
IOException
public byte setOutputState(int port, byte power, int mode, int regulationMode, int turnRatio, int runState, int tachoLimit) throws IOException
port
- - Output port (0 - 2 or 0xFF for all three)power
- - Setpoint for power. (-100 to 100)mode
- - Setting the modes MOTORON, BRAKE, and/or REGULATED. This parameter is a bitfield, so to put it in brake mode and regulated, use BRAKEMODE + REGULATEDregulationMode
- - see NXTProtocol for enumerationsturnRatio
- - Need two motors? (-100 to 100)runState
- - see NXTProtocol for enumerationstachoLimit
- - Number of degrees(?) to rotate before stopping.
IOException
public int getTachoCount(int port) throws IOException
port
- - 0 to 3
IOException
public byte resetMotorPosition(int port, boolean relative) throws IOException
port
- Output port (0-2)relative
- TRUE: position relative to last movement, FALSE: absolute position
IOException
public void setVerify(boolean verify)
public void close() throws IOException
IOException
public int getBatteryLevel() throws IOException
IOException
public InputValues getInputValues(int port) throws IOException
IOException
public byte setInputMode(int port, int sensorType, int sensorMode) throws IOException
port
- - 0 to 3sensorType
- - Enumeration for sensor type (see NXTProtocol)sensorMode
- - Enumeration for sensor mode (see NXTProtocol)
IOException
public byte playTone(int frequency, int duration) throws IOException
frequency
- duration
- - In milliseconds.
IOException
public DeviceInfo getDeviceInfo() throws IOException
IOException
public FirmwareInfo getFirmwareVersion() throws IOException
IOException
public byte deleteUserFlash() throws IOException
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |