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:
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.
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.
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.
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.
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:
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:
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..
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.
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.