PC GUI Tools
PC GUI Tools

The NXJ Browser

leJOS NXJ includes a PC-based file browser for viewing and manipulating the files on the NXT.

It is started by the nxjbrowse script. If you are using an IDE, you can set NXJ Browse up as an external tool.

The NXJ Browser need the NXT it is connecting to, to be turned on and to be running the leJOS start-up menu. Although it should work while a user program is running, if the program starts the LCPBTResponder thread, this is not recommended.

The NXJ Browser first looks for a NXT connected by USB, and if it finds one shows just that in the selection window.

If it cannot find a USB-connected NXT, it does a Bluetooth inquiry to find any NXTs in range and shows them in the selection window. You then select the one you wish to connect to, and press connect.

After pressing Connect, the main browser screen is shown:

The NXJ browser shows you all the files on your NXT, together with their size in bytes and their location in the file system (start page, end page). See “Understanding the leJOS NXJ File System” to understand the meaning of the start and end pages.

The friendly name of the NXT you are connected to is shown in the title bar of the Windows – the name is “NXT” in this case.

From this screen, you can:

  • Delete programs

  • Upload programs and other files to the NXT

  • Download files from the NXT to the OC

  • Run programs

  • De-fragment the file system

  • Set the friendly name of the NXT

Deleting programs

To delete files from the NXT, click the Delete tick boxes and press Delete Files. The next will make a chirping sound for each file deleted, and the NXJ Browser display will be updated. If the NXT is on the Files menu, its LCD will also be updated. An automatic defrag will occur when files are deleted, so there should be no gaps in the file system.

Uploading files

When you click Upload File, an Open file dialog box appears. Browse for the file you want to upload, select it, and click Open. NXJ Browse is not normally used for uploading program files as this is better done using the nxj or nxjupload tool or the leJOS Eclipse plugin. However, it is useful for uploading WAV files and data files for programs.

Downloading files

Files can be downloaded from the NXT to the PC by selecting the NXT file and pressing “Download”. This open a dialog that allows you to select the folder and filename to download the file to.

Running programs

A program on the NXT can be run by selecting it and pressing “Run”. This shuts down NXJ Browser.

De-fragmenting the file system

The NXT file system cab be defragmented (removing any gaps between files) by pressing “Defrag”. In the latest versions of leJOS the file system does not normally need to be defragmented.

Setting the friendly name of the NXT

The Bluetooth friendly name of the NXT can be set by pressing “Set Name”, filling in the name (up to 16 characters) and pressing OK. Note that the Bluetooth power be on in order to set the friendly name, even if the connection to the NXT is by USB.

Back to top

Remote Monitoring and Tracing

You can monitor a leJOS program over a Bluetooth connection while it is running by starting the LCPBTResponder thread and running the NXJ Monitor tool on the PC.

You an example of this, see the MonitorTest sample.

NXJ Monitor lets you see the values of sensors, and the values of motor tachometers, in near real-time, while your program executes.

It also lets you program displaying tracing messages to indicate what it is doing. These are displayed on the NXJ Monitor screen.

The program being monitored should include the following code in its start-up sequence:

LCPBTResponder lcpThread = new LCPBTResponder();

On the PC, the NXJ Monitor tool should be run. NXJ Monitor lists the NXTs available over Bluetooth in the same way as the NXJ Browser tool, and lets you choose which one you wish to connect to.

When a connection has been made, the following window is displayed:

Back to top

Data Viewer

The Data Viewer displays the output from DataLogger. You can cut and paste the data into a spreadsheet for further analysis. It uses USB by default, but you can select Bluetooth if you wish. When you start the program, this window appears:

It connects to the NXT via USB by default, but if you click the Use BlueTooth button, it will.. For the fastest BlueTooth connection, enter the Bluetooth address. If you don’t know it, enter the NXT name. Otherwise, the program will take some time to search and complete the connection. By default, the program displays 2 data values per row, but you can enter any number you wish before starting to download. The DataLogger gives you the option to resending its data if you want to see it again (with a different row length for example). If you do, click the Start Download button again..

Back to top

The Console viewer

The Console Viewer displays the output from RConsole, which is described in the section of Error Handling and Debugging. When you start the program, this window appears:

It connects to the NXT via USB by default, but if you click the Use BlueTooth button, it will. For the fastest BlueTooth connection, enter the Bluetooth address. If you don’t know it, enter the NXT name. Otherwise, the program will take some time to search and complete the connection.

The Connect button will initiate the connection with the NXT provided that the RConsole program is running on the NXT.

Back to top


This is the GUI version of NXJFlash. It installs the firmware into the flash memory of your NXT. If your NXT has a recent version of the firmware already installed, it only needs to be turned on and connected to the PC with the USB cable. Otherwise, it needs to be put into firmware update mode by pressing the reset button for 4 seconds or more.

When the program opens, it looks like this:

When you click start you see this :

The next message is :

If you click Yes, the entire flash memory of the NXT will be cleared. If you click no and the installation fails, it might be because the the flash memory has been badly corrupted. In which case, try again and click Yes.

As the installation proceeds, the progress log will be written. At the end, you have a chance to install firmware again.

Back to top

NXT Charting Logger

The NXT Charting Logger is another data logging utility that uses a well-defined columnar format (columns defined via the lejos.util.LogColumn class) that [optionally] saves the data to a file. Its main feature is that it uses JFreeChart to provide a dynamic X-Y time series chart of the incoming data from the NXT. The chart can be dynamically zoomed and panned [with optional domain skew] to examine the plot in any level of detail you desire. The chart series can be hidden, highlighted, and cloned into a fresh window to display subsets of the data. All charts can be copied as .PNG format to be included in other documents, reports, presentations, etc.

The NXT Charting Logger as it appears when logging data:

NXT Charting Logger as it is logging data

The utility works in conjunction with the lejos.util.NXTDataLogger class running on the NXT. NXT Charting Logger is launched by using the NXJChartingLogger shell script or .BAT file from the <LEJOS_HOME>\bin directory.

Use the Connect/Disconnect button (shown in the connected state above) to Connect/Disconnect to the NXT running NXTDataLogger. 

You can specify a filename and folder/directory where you want the data logged saved to as tab-delimited data. You can leave this empty to just log to the Data Log tab without saving the data. This data can always be copied (select and CTRL+C) and pasted as well. If you select to log to an existing file, you will be asked to overwrite or append the data as shown in this image:

:file whack or append chicken test

Chart control

The dynamic chart control commands are:

  • Zooming
    • Historical extents (including clipped due to Domain Display Limiting): Double-Left Mouse click on chart area
    • Reset Historical extents to current: CTRL+Double-left Mouse click on chart area
    • Current extents: Left Mouse click-drag to left, and/or up then release
    • Zoom window: Left Mouse click-drag to right and down then release
    • Zoom in/out dynamic: Use mouse wheel
  • Panning dynamic: CTRL+Left Mouse click-drag
  • Slider changes domain scale dynamically from 0.1 to 100% of (domain) X dataset extents/range
  • Series Tootips: Hover over data point on a series and series name, x-y value is shown
  • Left Mouse click moves crosshair to nearest datapoint and those coordinates are displayed in lower right of chart area
  • Mouse-over series legend item highlights the series
  • Left Mouse click on series legend item toggles series visibility
  • Shift+Left Mouse click on chart toggles domain range delta display. While in this mode, move the mouse (while holding the shift key) to measure domain distances
The Chart Options Tab

 Chart Options
The chart options tab allows you to adjust many things about the chart:

  • Chart Title.
  • Axis labels.
  • Pause/Resume of incoming data. Use the button on the lower right. The charting logger uses a caching input stream that buffers up to 500,000 bytes to help ensure the NXT does not block on the writeLog() methods of the NXTDataLogger class. When you pause, this buffer will continue to allow the NXT to send data without blolcking so you can examine detail areas of the chart, etc. When the buffer is filled, thewriteLog() methods will block until the buffer begins to be emptied (by un-pausing of course).
  • Visibility of comment markers. Default is on.
  • Domain scrolling. When enabled (default), the chart will scroll when new data is received. When disabled, all data is displayed on the chart as it resizes the doman scale to fit the data. Note that this affects performance.
  • Display Limiting. This option allows you to "clip" data from the chart (on the left as it comes in on the right) either by time or datapoint threshold. This is useful for instance when using the chart to display PID internals while manipulating control constants and other parameters. The full dataset is retained in the Data Log and log file (if saving to one).

Back to top