public class TurtleRobot extends LegoRobot
LegoRobot.ClosingMode
isConnecting
ABOUT, ANGLE, ANGLESTEPSMODE, BOOLEANMODE, BOOT, BRAKE, CELSIUSMODE, CLOSE, CUSTOM, DEBUG_LEVEL_HIGH, DEBUG_LEVEL_LOW, DEBUG_LEVEL_MEDIUM, DEBUG_LEVEL_OFF, DELETE, DELETE_USER_FLASH, DIRECT_COMMAND_NOREPLY, DIRECT_COMMAND_REPLY, FAHRENHEITMODE, FIND_FIRST, FIND_NEXT, GET_BATTERY_LEVEL, GET_CURRENT_PROGRAM_NAME, GET_DEVICE_INFO, GET_FIRMWARE_VERSION, GET_INPUT_VALUES, GET_OUTPUT_STATE, HIGH_SPEED_BUFFER, KEEP_ALIVE, LIGHT_ACTIVE, LIGHT_INACTIVE, LOWSPEED, LOWSPEED_9V, LS_GET_STATUS, LS_READ, LS_WRITE, MESSAGE_READ, MESSAGE_WRITE, MODEMASK, MOTOR_RUN_STATE_IDLE, MOTOR_RUN_STATE_RAMPDOWN, MOTOR_RUN_STATE_RAMPUP, MOTOR_RUN_STATE_RUNNING, MOTORON, NO_OF_SENSOR_TYPES, NO_SENSOR, NXJ_FIND_FIRST, NXJ_FIND_NEXT, OPEN_APPEND_DATA, OPEN_READ, OPEN_READ_LINEAR, OPEN_WRITE, OPEN_WRITE_DATA, OPEN_WRITE_LINEAR, PCTFULLSCALEMODE, PERIODCOUNTERMODE, PLAY_SOUND_FILE, PLAY_TONE, POLL, POLL_BUFFER, POLL_LENGTH, RAWMODE, READ, REFLECTION, REGULATED, REGULATION_MODE_IDLE, REGULATION_MODE_MOTOR_SPEED, REGULATION_MODE_MOTOR_SYNC, REPLY_COMMAND, RESET_MOTOR_POSITION, RESET_SCALED_INPUT_VALUE, SET_BRICK_NAME, SET_INPUT_MODE, SET_OUTPUT_STATE, SLOPEMASK, SOUND_DB, SOUND_DBA, START_PROGRAM, STOP_PROGRAM, STOP_SOUND_PLAYBACK, SWITCH, SYSTEM_COMMAND_NOREPLY, SYSTEM_COMMAND_REPLY, TEMPERATURE, TITLE, TITLEMP, TRANSITIONCNTMODE, VERSION, WRITE
Constructor and Description |
---|
TurtleRobot()
Same as TurtleRobot(btName), but ask for Bluetooth name
|
TurtleRobot(long address)
Same as TurtleRobot(address, true)
|
TurtleRobot(long address,
boolean showPane)
Same as TurtleRobot(btName, showPane), but Bluetooth address given.
|
TurtleRobot(java.lang.String btName)
Same as TurtleRobot(btName, true)
|
TurtleRobot(java.lang.String btName,
boolean showPane)
Creates a turtle robot instance using a NXT brick with given Bluetooth name.
|
Modifier and Type | Method and Description |
---|---|
TurtleRobot |
backward(int steps)
Moves the turtle backward the given number of steps.
|
void |
exit()
Closes the Bluetooth communication and terminates the program.
|
TurtleRobot |
forward(int steps)
Moves the turtle forward the given number of steps.
|
Gear |
getGear()
Returns the gear used as component of the turtle.
|
int |
getTurtleSpeed()
Returns the current turtle speed.
|
TurtleRobot |
left(int angle)
Turns the turtle to the left for the given angle.
|
TurtleRobot |
right(int angle)
Turns the turtle to the right for the given angle.
|
TurtleRobot |
setTurtleSpeed(int speed)
Sets the turtle speed to the given value.
|
addPart, clearDisplay, connect, connect, connect, disconnect, drawString, drawStringAt, fileExists, findFirst, findNext, getAbout, getBatteryLevel, getBtAddress, getBtAddressLong, getBtName, getDebugLevel, getFriendlyName, getHitButtonID, getInputStream, getOutputStream, getProperties, getStreamConnection, getVersion, isButtonHit, isButtonListenerRunning, isConnected, isDownHit, isEnterHit, isEscapeHit, isLeftHit, isRightHit, isRunning, isUpHit, keepAlive, playConnectMelody, playDisconnectMelody, playTone, readData, requestData, reset, sendData, setChannel, startButtonListener, startProgram, stopButtonListener
public TurtleRobot(java.lang.String btName, boolean showPane)
btName
- the Bluetooth friendly name, e.g. NXTshowPane
- if true, an information pane is showed, where the turtle commands are listedpublic TurtleRobot(java.lang.String btName)
btName
- the Bluetooth friendly name, e.g. NXTpublic TurtleRobot()
public TurtleRobot(long address, boolean showPane)
address
- the 48-bit Bluetooth address as longshowPane
- if true, an information pane is showed, where the turtle commands are listedpublic TurtleRobot(long address)
address
- the 48-bit Bluetooth address as longpublic Gear getGear()
public TurtleRobot setTurtleSpeed(int speed)
speed
- 0..100public int getTurtleSpeed()
public TurtleRobot forward(int steps)
steps
- the number of steps to go.public TurtleRobot backward(int steps)
steps
- the number of steps to go.public TurtleRobot left(int angle)
angle
- the angle in degree to rotate.public TurtleRobot right(int angle)
angle
- the angle in degree to rotate.