nxtrc (1) - Linux Manuals

nxtrc: a program to interact with LEGO NXT via BlueTooth


nxtrc - a program to interact with LEGO NXT via BlueTooth


nxtrc [-s]

nxtrc [-a ADDR] [-v] command


NXTRC (NXT Remote Command) is a small program that allows to send various commands to a LEGO Mindstorm NXT Brick. It uses the Bluetooth protocol through the Bluez libraries.

The option -s starts a scan to find BlueTooth devices. If a BT address is given in the command line or is in the Environment Variable BTADDR it connects to the NXT and performs the task specified in <command>. The first time you connect with a device you need to exchange a password, this task is usually done by the Operative System BlueTooth Management (as Kbluetooth under KDE).


BlueTooth Address of the NXT, required if BTADDR Environment Variable is not set to the address
Get Battery Level
Delete FILE frome NXT
display a short help text
Get info on NXT brick
Stop a program running on NXT
List files on NXT brick matching PATTern if present (e.g. -l*.rxe) N.B. No spaces between -l and PATT! see at the end the patterns allowed
Play sound file FILE once
Play sound file FILE indefinitely
Set NXT name to NAME
Run Program FILE on NXT
Read FILE frome NXT and save it in the working directory if FILE is already present ask for permission to overwrite
Be verbose. This is the only option that can be given with another command. It's not always very useful....
Write FILE on NXT, If FILE is already present ask for permission to overwrite
Same as -w forcing overwrite if FILE exists
Stop Sound Playback

File Names and Patterns

On the NXT File names are of the form "Name.Ext" with max 15 characters for the Name and 3 for the Extension. When asking a listing with the -l command you can give a specific file name to see if it's on the NXT and list its size, or a Pattern using widlcards. Due to the limitation of the NXT API patterns are limited to the form "*.ext", "Name.*" or "*.*" this last one is the default and can be omitted.


scan for devices

 nxtrc -s 

  00:10:20:30:40:50  NXT1 

  00:01:01:02:03:04  NXT2 

set up Environment Variable for connection with NXT1 and ask for info

 export BTADDR=00:10:20:30:40:50

 nxtrc -i

load program Prog.rxe on NXT1 and run it

 nxtrc -W Prog.rxe

 nxtrc -p Prog.rxe


nxtrc returns a zero exit status if it succeeds. Non zero is returned in case of failure.


Gian Piero Puccioni (gianpiero.puccioni (at) isc.cnr.it)