|
Page 1 of 1
|
[ 8 posts ] |
|
Author |
Message |
Shep
Novice
Joined: Fri Jan 18, 2008 11:07 pm Posts: 51 Location: Ohio
|
 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 |
|
 |
tfriez
Site Admin
Joined: Wed Jan 24, 2007 10:42 am Posts: 620
|
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 |
|
 |
Shep
Novice
Joined: Fri Jan 18, 2008 11:07 pm Posts: 51 Location: Ohio
|
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 |
|
 |
elizabeth.mabrey
Expert
Joined: Sun Aug 19, 2007 2:43 pm Posts: 156 Location: New Jersey
|
 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 |
|
 |
docilio
Expert
Joined: Sun Sep 09, 2007 10:12 am Posts: 116
|
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...
|
Sat Jul 05, 2008 1:03 pm |
|
 |
elizabeth.mabrey
Expert
Joined: Sun Aug 19, 2007 2:43 pm Posts: 156 Location: New Jersey
|
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 |
|
 |
docilio
Expert
Joined: Sun Sep 09, 2007 10:12 am Posts: 116
|
btConnect works fine here...
I am doing some work with BT, so when i finnish it, i could post it here.
|
Sat Jul 05, 2008 7:17 pm |
|
 |
elizabeth.mabrey
Expert
Joined: Sun Aug 19, 2007 2:43 pm Posts: 156 Location: New Jersey
|
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 |
|
|
|
Page 1 of 1
|
[ 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
|
|