Loginskip to content

December 2nd, 2009

BricxCC and the Bluetooth Blues

Several people have posted questions on the nxtasy forums asking for help connecting to their NXT via Bluetooth using the Bricx Command Center (BricxCC).   

First, make sure you have the latest test release of BricxCC.  You can always download it from this link:

http://bricxcc.sourceforge.net/test_release.zip 

Extract the zip over your existing BricxCC installation. 

Now look in %appdata%\JoCar Consulting\BricxCC\3.3\ for a file called nxt.dat.  The actual path differs depending on the version of Windows you are running but %appdata% should expand to the right path on your computer.  Edit this file with a plain text editor such as notepad.   Look for a line something like this:

BTH::BNXT=BTH::BNXT::00:16:53:0A:75:7B::1

If there isn’t anything like that in the file then add one.  Everything to the left of the equal sign is an alias for the value to the right of the equal sign.  The alias can be anything you like.  To the right of the equal sign is a brick resource string.  The bluetooth brick resource string consists of “BTH::” followed by the name you have assigned to your NXT.  By default that is just “NXT”.  Mine happens to be called BNXT. Whatever your NXT’s name is just use that instead of BNXT.  Follow the name with a pair of colons “::”.  Then comes your NXT’s unique ID which you can see via the brick menu system by navigating to Settings|NXT Version.  The ID is at the bottom of the screen.  Here’s a screenshot from my NXT:

NXT Version

Separate each pair of hex digits with a single colon “:”.  My NXT’s ID is 0016530A757B.  That becomes 00:16:53:0A:75:7B as you see above.  Follow the ID with another pair of colons “::”.  Last comes the virtual serial port number that is created when you connect your NXT to the PC via Bluetooth.  Sometimes mine is 1 and other times it is 5.  The value here probably will not make any difference in whether you can connect or not.

Once you have a bluetooth brick resource string entry in nxt.dat for your NXT then you will be able to pick both the short alias and the full brick resource string from the drop-down list of Ports when you launch BricxCC.  The very first time you connect to an NXT via Bluetooth you’ll have to confirm the PIN on the NXT.  Be sure to pay attention to it prompting you to confirm the PIN number.  It takes a little while for the connection to be made but afterward communication between the NXT and BricxCC via Bluetooth should be pretty quick.  Also make sure that you check the option in the Preferences dialog to use the internal NBC/NXC compiler.  Otherwise compiling and downloading programs will be way too slow.

Users of NBC/NXC or any of my NXT utilities on Mac OS X or Linux platforms can also communicate with their NXT via Bluetooth.  The nxt.dat file on non-Windows platforms lives in the Home directory (~/nxt.dat).