We're working on a cool underwater robot project where we use three NXT bricks - two for sensors and one for main processing and motor control. The two sensor bricks (slaves) capture sensor data and should send it to the master continuously. The master processes the data and decides what actions to take.

We understand the master-slave concept and we have paired and established contacts correctly, but can only get the master to talk to one brick, not both. We read that the master must send a message to each slave before the slave can respond. But can't find any examples or even functions for the master message. Does anybody know what function(s) would work? Also, do we need to include "btConnect" and "btDisconnect" in the code?

Mon Dec 15, 2014 8:22 pm

tabbycatrobots

Rookie

Joined: Wed Dec 03, 2014 5:57 pmPosts: 22

Re: Using Bluetooth with 3 NXT bricks

I have a library of functions that I put together to reliably connect 4 NXTs, but itis coded in NXC. I used NXC for my NXTs, and use RobotC for my EV3. If thiswill help you, I can email the files to you. It is a lot of code to post online.You may be able to translate my NXC code to RobotC, or at least see the sequenceof calls. It took me about a month to get it to reliably connect 4 NXTs. And eventhen sometimes, like at Brickfair, when there are dozens (100s) of people around withcell phones, it would time out if I tried to connect more than 2 NXTs. Are there manyother BT devices near your NXTs? The other thing I did that seemed to increasereliability, was to always send a 32 value, not other data types. Oh, just to clarify,I had one master and 3 slaves.

Mon Dec 15, 2014 10:09 pm

tito

Rookie

Joined: Wed Mar 26, 2014 12:39 pmPosts: 7

Re: Using Bluetooth with 3 NXT bricks

I actually doubt that 1 NXT BT master can connect to more than 1 NXT BT slave by RobotC... :-/ (CMIIW)

Tue Dec 16, 2014 2:34 pm

tabbycatrobots

Rookie

Joined: Wed Dec 03, 2014 5:57 pmPosts: 22

Re: Using Bluetooth with 3 NXT bricks

Can RobotC use multiple BT channels? Assuming it is possible for RobotC to connectto multiple NXTs (I'm still learning RobotC), here are a couple more ideas.Are you using different BT channels for each slave? In NXC, I had the master connect toa slave on channel 0, then after testing the connection, they would use a unique channel foreach slave. And there are some good BT coding ideas in these 2 books. They are aboutNXC, but they may give you some ideas.Creating Cool Mindstorms NXT Robots by Daniele BenedettelliLEGO Mindstorms NXT Power Programming Robotics In C by John C. Hansen

The ROBOTC BT messaging has been optimized for a single slave connection on the master. ...ROBOTC also allows for multiple slave support, but a description of this is beyond the scope of this tutorial.

Wed Dec 17, 2014 5:48 am

ghostthirteen

Rookie

Joined: Thu Apr 03, 2014 11:15 pmPosts: 2

Re: Using Bluetooth with 3 NXT bricks

Thanks Burning Lights. We'll give it a try and let you know...

Tue Dec 30, 2014 12:59 am

lepperk

Rookie

Joined: Tue Apr 05, 2016 8:24 amPosts: 3

Re: Using Bluetooth with 3 NXT bricks

Has anyone made this work? I'm working with a Robofest team. They've made a Pac-Man game with robots -- one robot is Pac-Man, two are ghosts. The Pac-man robot is controlled by an NXT-built joystick. We're trying to have another NXT control the two robots -- at least to the extent that it can send a message when the game is over so that the ghosts stop moving. We have programmed this successfully for one ghost but cannot figure out how to have the controller successfully send messages to both ghosts.

I expect we need some way to tell the controller which NXT 'ghost' to send the message to, but I cannot find any information on how to program that. I understand that this may slow communication down a little, but for our application I don't think it will make a big difference. If you've had any success in RobotC 4.x, please share!

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum