Bluetooth RobotC to NXC

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
bmancan
Posts: 9
Joined: 14 Oct 2012, 01:52

Bluetooth RobotC to NXC

Post 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
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: Bluetooth RobotC to NXC

Post 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
---> Link to lots of MINDSTORMS stuff under my picture --->
bmancan
Posts: 9
Joined: 14 Oct 2012, 01:52

Re: Bluetooth RobotC to NXC

Post 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
aswin0
Posts: 201
Joined: 29 Sep 2010, 06:58

Re: Bluetooth RobotC to NXC

Post 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
My blog: nxttime.wordpress.com
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: Bluetooth RobotC to NXC

Post by HaWe »

RC recently supports more than 1+1 NXTs via BT?
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: Bluetooth RobotC to NXC

Post 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
---> Link to lots of MINDSTORMS stuff under my picture --->
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: Bluetooth RobotC to NXC

Post 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).
aswin0
Posts: 201
Joined: 29 Sep 2010, 06:58

Re: Bluetooth RobotC to NXC

Post 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.
My blog: nxttime.wordpress.com
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests