nxtrc (1) - Linux Manuals

nxtrc: a program to interact with LEGO NXT via BlueTooth

NAME

nxtrc - a program to interact with LEGO NXT via BlueTooth

SYNOPSIS

nxtrc [-s]

nxtrc [-a ADDR] [-v] command

DESCRIPTION

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

-a
BlueTooth Address of the NXT, required if BTADDR Environment Variable is not set to the address
-b
Get Battery Level
-d FILE
Delete FILE frome NXT
-h
display a short help text
-i
Get info on NXT brick
-k
Stop a program running on NXT
-l[PATT]
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
-v
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
-z
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.

EXAMPLES

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

EXIT STATUS

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

AUTHOR

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