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).
COMMANDS and OPTIONS
BlueTooth Address of the NXT, required if BTADDR Environment Variable is not set to the address
Get Battery Level
- -d FILE
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
- -m FILE
Play sound file FILE once
- -M FILE
Play sound file FILE indefinitely
- -n NAME
Set NXT name to NAME
- -p FILE
Run Program FILE on NXT
- -r FILE
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....
- -w FILE
Write FILE on NXT, If FILE is already present ask for permission to overwrite
- -W FILE
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
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)