1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Bluetooth RobotC to NXC

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.

Bluetooth RobotC to NXC

Postby bmancan » 29 Oct 2012, 23:44

I have just finished building a multi robot project that includes 2 NXTs programmed in NXC, and 1 NXT programmed in RobotC. Everything is working great with each independent program, but I need to be able to pass a couple of messages between the NXTs.
I tried setting the RobotC NXT as the master for BT connection with one of the other NXTs as slave (NXC with 1.31 EFW). The NXTs are paired up and have established a connection. The problem is that I have been unable to get any type of message to be sent from the slave to the master.

In the NXC program on the slave NXT I am using the BluetoothWrite function.

x = BluetoothWrite(0, data); // connection to port 0 which is the master

This functions returns the value 32, I have been unable to find what the return codes should be.

In the RobotC program I have tried many different things including:

cCmdMessageRead(nQueueID, nRcvBuffer, nSizeOfMessage);

Can anyone confirm that messaging should work between RobotC and NXC programs?
I can post some actual code snippets if it would help.

BManCan
bmancan
 
Posts: 8
Joined: 14 Oct 2012, 01:52

Re: Bluetooth RobotC to NXC

Postby hassenplug » 30 Oct 2012, 13:17

I have not tried in a while, but last time I used Robot C, it used a different format for the messages than NXC. At one point, it was set-up for pier to pier communication, not master-slave, like the standard LEGO firmware.

Now that I think about it, in the standard firmware (and EFW), the slave will wait for the master to request a message, before the slave will actually send the message. Robot C does not do that.

Try setting up the NXC NXT as the master, and have it send the message. Robot C should receive it. It may be more involved if you want to send a message back from Robot C to NXC.

Steve
---> Link to lots of MINDSTORMS stuff under my picture --->
User avatar
hassenplug
 
Posts: 336
Joined: 27 Sep 2010, 03:05

Re: Bluetooth RobotC to NXC

Postby bmancan » 31 Oct 2012, 21:46

hassenplug wrote:Try setting up the NXC NXT as the master, and have it send the message. Robot C should receive it. It may be more involved if you want to send a message back from Robot C to NXC.

Steve


Thanks very much for the guidance. I setup the NXC NXT as the master, and was able to send a BT message to the RobotC NXT with very little difficulty.
I will have to change my strategy slightly. Original plan had RobotC master with two NXC slaves. New plan will be NXC master with one RobotC slave and one NXC slave.

Thanks again.
BManCan
bmancan
 
Posts: 8
Joined: 14 Oct 2012, 01:52

Re: Bluetooth RobotC to NXC

Postby aswin0 » 31 Oct 2012, 22:36

Hi,

Steve is right. but I think there is the possibility in robotC to change BT to a maste slave protocol to support multiple connections in robotC. Look for multiple clients or half duplex in the manual.

Aswin
My blog: nxttime.wordpress.com
User avatar
aswin0
 
Posts: 189
Joined: 29 Sep 2010, 06:58

Re: Bluetooth RobotC to NXC

Postby doc-helmut » 01 Nov 2012, 10:28

RC recently supports more than 1+1 NXTs via BT?
regards, HaWe aka Ford"A Kingdom of Heaven if NXC had recursions" Prefect
±≠≈αγδελπφωΔΦΣΩ∫√∈∉¬⊂⊄∩∪∅∞
NXC CHESS for NXT: url= http://www.mindstormsforum.de/viewtopic.php?f=70&t=6790

wishful for NXC: easy + trouble-free network & I/O remote control for rs485, Xbee, and BT !
User avatar
doc-helmut
 
Posts: 1988
Joined: 29 Sep 2010, 14:25

Re: Bluetooth RobotC to NXC

Postby hassenplug » 01 Nov 2012, 13:03

I'm sure Robot C can be configured to send the master-messages, if you want to do that. You'll just have to figure out what those messages need to be.

Steve
---> Link to lots of MINDSTORMS stuff under my picture --->
User avatar
hassenplug
 
Posts: 336
Joined: 27 Sep 2010, 03:05

Re: Bluetooth RobotC to NXC

Postby doc-helmut » 01 Nov 2012, 14:35

ok, RC supporting more than 2 bricks connected to each other by BT must be a new feature. In earlier releases that was always limited to 2 (IIRC, 1 master +1 slave).
regards, HaWe aka Ford"A Kingdom of Heaven if NXC had recursions" Prefect
±≠≈αγδελπφωΔΦΣΩ∫√∈∉¬⊂⊄∩∪∅∞
NXC CHESS for NXT: url= http://www.mindstormsforum.de/viewtopic.php?f=70&t=6790

wishful for NXC: easy + trouble-free network & I/O remote control for rs485, Xbee, and BT !
User avatar
doc-helmut
 
Posts: 1988
Joined: 29 Sep 2010, 14:25

Re: Bluetooth RobotC to NXC

Postby aswin0 » 01 Nov 2012, 18:40

This is what the robotC manual has to say about it.
RobotC also allows For multiple slave support, but a description of this is beyond the scope of this manual.
My blog: nxttime.wordpress.com
User avatar
aswin0
 
Posts: 189
Joined: 29 Sep 2010, 06:58


Return to Mindstorms Software

Who is online

Users browsing this forum: No registered users and 0 guests