Page 1 of 1

Bluetooth RobotC to NXC

Posted: 29 Oct 2012, 23:44
by bmancan
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

Re: Bluetooth RobotC to NXC

Posted: 30 Oct 2012, 13:17
by hassenplug
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

Re: Bluetooth RobotC to NXC

Posted: 31 Oct 2012, 21:46
by bmancan
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

Re: Bluetooth RobotC to NXC

Posted: 31 Oct 2012, 22:36
by aswin0
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

Re: Bluetooth RobotC to NXC

Posted: 01 Nov 2012, 10:28
by HaWe
RC recently supports more than 1+1 NXTs via BT?

Re: Bluetooth RobotC to NXC

Posted: 01 Nov 2012, 13:03
by hassenplug
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

Re: Bluetooth RobotC to NXC

Posted: 01 Nov 2012, 14:35
by HaWe
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).

Re: Bluetooth RobotC to NXC

Posted: 01 Nov 2012, 18:40
by aswin0
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.