Loginskip to content

Archive for November 25th, 2006

Tip of The Day - Bluetooth Connection between 2 NXT’s

Saturday, November 25th, 2006

Even after being an MDP and MCP for so many months, I am embarrassed to say that this is the first time I have really dug into connecting two NXT’s together via Bluetooth.  I toyed around with it after receiving my second NXT set, but never really did anything as I always had 2 robots on the go… After working on my latest bot, I decided I was going to stray away from my standard autonomous robot building approach and use another NXT as a remote.  There are many others out there that have already done this - (BTW Thx to Brian Davis for your help here).

After building both the host and remote apps to send / receive BT messages for the 2 NXT’s I found that values were simply not getting passed to the receiving NXT. At first I thought it was the code, but I checked, and the messages were being sent to the correct mailbox numbers.  I also checked the connection which was the correct value (#1).  But, this is where I made my mistake. I assumed that both NXT units connected on the same BT port (I looked to the client NXT to get the port number). This is not the case. In fact, the HOST showed the client on port #0 and the client showed the host on port #1.   On my host application, I had specified to send the messages out on port #1, but the BT connection was on Port #0. Once I changed the software to send out on Connection #0, it worked fine.

So, if you are having a similar issue, be sure to verify the connection from each NXT unit.  The software you are writing for the host should use the same connection # that the NXT shows when viewing connections on the LCD screen in the BT settings.