View unanswered posts | View active topics It is currently Sat Aug 30, 2014 2:40 am






Reply to topic  [ 8 posts ] 
BT with Multiple NXTs 
Author Message
Novice

Joined: Fri Jan 18, 2008 11:07 pm
Posts: 51
Location: Ohio
Post BT with Multiple NXTs
I have to admit, I am a novice with C-like programs. I have been studying the Bluetooth sample programs looking for a way to communicate with more than one other NXT, but I am not having much luck.

Does anyone have any pointers or better yet, some sample code that I can use to help me along?


Sat Jan 26, 2008 6:58 pm
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 602
Post 
ROBOTC currently only supports two forms of BT communication.

PC via BT to the NXT.
NXT via BT to another NXT.

If you explain exactly what you would like to do, I could help you out with some sample programs/code.

There are currently some samples in the ROBOTC for Mindstorms 1.10 build that illustrate the bluetooth communication. There's an entire folders of samples that should get you started :)

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Wed Jan 30, 2008 5:04 pm
Profile
Novice

Joined: Fri Jan 18, 2008 11:07 pm
Posts: 51
Location: Ohio
Post 
I am doing pretty simple stuff. As with with NXT-G, I was going to use one NXT as a master and the rest as slaves. I want to send simple values back and forth and store them in a variable on the master.

My project is a series of Gantry robots that all ride on the same track. I want section out the length of track into 10 or so sections. The master would maintain a log of which sectors are occupied and which are open. The master would stop the slaves from hitting each other.

If ROBOTC is restricted right now to one on one communication, I am going to have to come up with an inovative way to communicate with all NXTs

I have looked thoroughly at the BT sample code, but some of the undocumented stuff keeps throwing me. I have sent that code to two NXTs but I have had no success as of yet.

Any help would be appreciated.


Wed Jan 30, 2008 7:26 pm
Profile
Expert

Joined: Sun Aug 19, 2007 2:43 pm
Posts: 136
Location: New Jersey
Post fails to receive if more than a single connection?
Setup:
- one master has connections to all 3 slaves, named s1, s2, s3 at slot id 1, 2, and 3 respectively.

What works:
- the master sends a single byte ONLY to s1 via id 1. It works.

What does not work:
- the master sends a message ONLY to s2 via id 2. But, s2 did not get any message.
- then, I manually disconnect s1 from master. Run the same program, s2 immediately is able to get messages from master.
- note that s3 is still connected thru the manual setup.
- This tells me that only the slave at the 1st queue can get message. Is this an expected behavior?

Does anyone have suggestion how to resolve this issue?


Sat Jul 05, 2008 9:10 am
Profile WWW
Expert

Joined: Sun Sep 09, 2007 10:12 am
Posts: 116
Post 
That's not a good way, but if time is not a problem, you could do this:

1- Connect S1.
2- SEND
3- Disconnect S1.

4- Connect S2.
5- SEND
6- Disconnect S2.

7- Connect S3.
8- SEND
9- Disconnect S3.

10 - Go back to 1...

_________________
http://www.apcsguarda.com
My Project: http://www.robotc.net/forums/viewtopic.php?f=15&t=712


Sat Jul 05, 2008 1:03 pm
Profile
Expert

Joined: Sun Aug 19, 2007 2:43 pm
Posts: 136
Location: New Jersey
Post 
hmmm.... that's what I'm afraid of ... .must disconnect before you send.

btConnect (port, name) has to work first. (assuming the port = queue id)

I tested it. It kept returning FILENOTFOUND...


Sat Jul 05, 2008 1:37 pm
Profile WWW
Expert

Joined: Sun Sep 09, 2007 10:12 am
Posts: 116
Post 
elizabeth.mabrey wrote:
hmmm.... that's what I'm afraid of ... .must disconnect before you send.

btConnect (port, name) has to work first. (assuming the port = queue id)

I tested it. It kept returning FILENOTFOUND...


btConnect works fine here...

I am doing some work with BT, so when i finnish it, i could post it here.

_________________
http://www.apcsguarda.com
My Project: http://www.robotc.net/forums/viewtopic.php?f=15&t=712


Sat Jul 05, 2008 7:17 pm
Profile
Expert

Joined: Sun Aug 19, 2007 2:43 pm
Posts: 136
Location: New Jersey
Post 
work ok now after I removed 1.1 and downloaded the 1.40 RC instead.

Still...this bluetooth communication works quite kludge! Once in a while, it will go into this funny state that the only way to get it to work again is to manually resetting everyone!


Sat Jul 05, 2008 9:29 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.