ROBOTC.net forums
http://robotc.net/forums/

Bluetooth/USB communication between computer and nxt
http://robotc.net/forums/viewtopic.php?f=1&t=7733
Page 1 of 1

Author:  LucaRood [ Sat Jan 18, 2014 8:06 pm ]
Post subject:  Bluetooth/USB communication between computer and nxt

Hi,

I am working on a robot that has to receive commands from a computer. I know this has been discussed multiple times, but despite all I've read I'm not getting it to work. I program in vb.net for some years now, and have less experience with c but no problems here. I am able to program a robot in c with no difficulties, my problem has always been with making devices communicate to each other.

Now here is the problem, I tried using code from here: http://www.extremenxt.com/vbfront.htm and from here: http://www.codeproject.com/Articles/18857/Communicating-with-LEGO-NXT-via-Bluetooth-in-C the first being in vb.net and the last being in c#, they are very similar, but have slight differences.

I get the PC talking to the NXT with no problems, but if i send a message to a NXT mailbox, I am only able to read it with the command "message" and not with "cCmdMessageRead". if I say "cCmdMessageGetSize" it returns 0, but if I say "message" it returns the message normally! I want to use "cCmdMessageRead" because I saw it can read up to 58 8-bit Bytes at once whereas "message" can only read one 16-bit byte (2 8-bit bytes), and because i want to be able to read each Byte separately. I know the "cCmdMessageRead" syntax perfectly, and know the output is in ubytes, so that is not a problem, the thing is that it acts like there is not even a message to read. I even tried sending only the message Bytes without those 6 Bytes before it that tell the NXT what to do, just to try, but obviously that went even worse, and I was not even able to read it with the "message" command, maybe i could use that with the "nxtReadRawBluetooth" command!? Why would I be able to read it with one command while the other tells me there is no message to read? Is there a bug, or am I doing something wrong? And what about "nxtReadRawBluetooth", how does that work, and would it be useful for me?

And about the USB thing:
Ideally I wanted the PC to Talk to the NXT through USB, to avoid delays, but i gave up on that, considering it is much harder than Bluetooth. But if anyone has any advice on USB message sending from the PC to the NXT, that would be appreciated.

Ps.: I am using RobotC 3.54

Thanks in advance,

Luca

Author:  LucaRood [ Thu Jan 23, 2014 4:35 pm ]
Post subject:  Re: Bluetooth/USB communication between computer and nxt

I already solved my problem, using raw bluetooth mode.
Could some admin please close this thread?!
Thanks.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/