NXT Direct Commands¶
Non-Visible component| Category | Requires | Version |
|---|---|---|
| LEGO® MINDSTORMS® > NXT | API 21, Android 5.0 Lollipop | 2 |
Overview¶
A component that provides a low-level interface to a LEGO MINDSTORMS NXT robot, with functions to send NXT Direct Commands.
Methods¶
Delete File¶
Delete a file on the robot.
| Param | Type |
|---|---|
| file Name | Text |
Download File¶
Download a file to the robot.
| Param | Type |
|---|---|
| source | Text |
| destination | Text |
Get Battery Level¶
Returns: Number
Get the battery level for the robot. Returns the voltage in millivolts.
Get Brick Name¶
Returns: Text
Get the brick name of the robot.
Get Current Program Name¶
Returns: Text
Get the name of currently running program on the robot.
Get Firmware Version¶
Returns: List
Get the firmware and protocol version numbers for the robot as a list where the first element is the firmware version number and the second element is the protocol version number.
Get Input Values¶
Returns: List
Reads the values of an input sensor on the robot. Assumes sensor type has been configured via SetInputMode.
| Param | Type |
|---|---|
| sensor Port Letter | Text NxtSensorPort |
| sensor Port Letter Option | Value |
|---|---|
| Port1 | 1 |
| Port2 | 2 |
| Port3 | 3 |
| Port4 | 4 |
Get Output State¶
Returns: List
Reads the output state of a motor on the robot.
| Param | Type |
|---|---|
| motor Port Letter | Text NxtMotorPort |
| motor Port Letter Option | Value |
|---|---|
| PortA | A |
| PortB | B |
| PortC | C |
Keep Alive¶
Returns: Number
Keep Alive. Returns the current sleep time limit in milliseconds.
List Files¶
Returns: List
Returns a list containing the names of matching files found on the robot.
| Param | Type |
|---|---|
| wildcard | Text |
Ls Get Status¶
Returns: Number
Returns the count of available bytes to read.
| Param | Type |
|---|---|
| sensor Port Letter | Text NxtSensorPort |
| sensor Port Letter Option | Value |
|---|---|
| Port1 | 1 |
| Port2 | 2 |
| Port3 | 3 |
| Port4 | 4 |
Ls Read¶
Returns: List
Reads unsigned low speed data from an input sensor on the robot. Assumes sensor type has been configured via SetInputMode.
| Param | Type |
|---|---|
| sensor Port Letter | Text NxtSensorPort |
| sensor Port Letter Option | Value |
|---|---|
| Port1 | 1 |
| Port2 | 2 |
| Port3 | 3 |
| Port4 | 4 |
Ls Write¶
Writes low speed data to an input sensor on the robot. Assumes sensor type has been configured via SetInputMode.
| Param | Type |
|---|---|
| sensor Port Letter | Text NxtSensorPort |
| list | List |
| rx Data Length | Number |
| sensor Port Letter Option | Value |
|---|---|
| Port1 | 1 |
| Port2 | 2 |
| Port3 | 3 |
| Port4 | 4 |
Message Read¶
Returns: Text
Read a message from a mailbox (1-10) on the robot.
| Param | Type |
|---|---|
| mailbox | Number NxtMailbox |
| mailbox Option | Value |
|---|---|
| Box1 | 1 |
| Box2 | 2 |
| Box3 | 3 |
| Box4 | 4 |
| Box5 | 5 |
| Box6 | 6 |
| Box7 | 7 |
| Box8 | 8 |
| Box9 | 9 |
| Box10 | 10 |
Message Write¶
Write a message to a mailbox (1-10) on the robot.
| Param | Type |
|---|---|
| mailbox | Number NxtMailbox |
| message | Text |
| mailbox Option | Value |
|---|---|
| Box1 | 1 |
| Box2 | 2 |
| Box3 | 3 |
| Box4 | 4 |
| Box5 | 5 |
| Box6 | 6 |
| Box7 | 7 |
| Box8 | 8 |
| Box9 | 9 |
| Box10 | 10 |
Play Sound File¶
Play a sound file on the robot.
| Param | Type |
|---|---|
| file Name | Text |
Play Tone¶
Make the robot play a tone.
| Param | Type |
|---|---|
| frequency Hz | Number |
| duration Ms | Number |
Reset Input Scaled Value¶
Reset the scaled value of an input sensor on the robot.
| Param | Type |
|---|---|
| sensor Port Letter | Text NxtSensorPort |
| sensor Port Letter Option | Value |
|---|---|
| Port1 | 1 |
| Port2 | 2 |
| Port3 | 3 |
| Port4 | 4 |
Reset Motor Position¶
Reset motor position.
| Param | Type |
|---|---|
| motor Port Letter | Text NxtMotorPort |
| relative | Boolean |
| motor Port Letter Option | Value |
|---|---|
| PortA | A |
| PortB | B |
| PortC | C |
Set Brick Name¶
Set the brick name of the robot.
| Param | Type |
|---|---|
| name | Text |
Set Input Mode¶
Configure an input sensor on the robot.
| Param | Type |
|---|---|
| sensor Port Letter | Text NxtSensorPort |
| sensor Type | Number NxtSensorType |
| sensor Mode | Number NxtSensorMode |
| sensor Port Letter Option | Value |
|---|---|
| Port1 | 1 |
| Port2 | 2 |
| Port3 | 3 |
| Port4 | 4 |
| sensor Type Option | Value |
|---|---|
| NoSensor | 0 |
| Touch | 1 |
| LightOn | 5 |
| LightOff | 6 |
| SoundDB | 7 |
| SoundDBA | 8 |
| ColorFull | 13 |
| ColorRed | 14 |
| ColorGreen | 15 |
| ColorBlue | 16 |
| ColorNone | 17 |
| Digital12C | 10 |
| Digital12C9V | 11 |
| RcxTemperature | 2 |
| RcxLight | 3 |
| RcxAngle | 4 |
| sensor Mode Option | Value |
|---|---|
| Raw | 0 |
| Boolean | 32 |
| TransitionCount | 96 |
| PeriodCount | 96 |
| Percentage | 128 |
| RcxCelsius | 160 |
| RcxFahrenheit | 192 |
| RcxAngleSteps | 224 |
Set Output State¶
Sets the output state of a motor on the robot.
| Param | Type |
|---|---|
| motor Port Letter | Text NxtMotorPort |
| power | Number |
| mode | Number NxtMotorMode |
| regulation Mode | Number NxtRegulationMode |
| turn Ratio | Number |
| run State | Number NxtRunState |
| tacho Limit | Number |
| motor Port Letter Option | Value |
|---|---|
| PortA | A |
| PortB | B |
| PortC | C |
| mode Option | Value |
|---|---|
| On | 1 |
| Brake | 2 |
| Regulated | 4 |
| Coast | 0 |
| regulation Mode Option | Value |
|---|---|
| Disabled | 0 |
| Speed | 1 |
| Synchronization | 2 |
| run State Option | Value |
|---|---|
| Disabled | 0 |
| Running | 32 |
| RampUp | 16 |
| RampDown | 64 |
Start Program¶
Start execution of a previously downloaded program on the robot.
| Param | Type |
|---|---|
| program Name | Text |
Stop Program¶
Stop execution of the currently running program on the robot.
Stop Sound Playback¶
Stop sound playback.
Properties¶
Bluetooth Client¶
Component Write - Designer
The BluetoothClient component that should be used for communication.