I am trying to send messages to the nxt via bluetooth using c#. The nxt reads the data and then displays it on the screen.However, I am confused on what is wrong with the program though I'm quite sure the issue is in the c# code, not RobotC.It is highly likely that the bytes I'm sending is wrong. If so, what should they be?

//for(int i=0;i<ReplyLength ;i++) I am currently not getting replies from the NXT, all I want is to send //{ // s1+=BluetoothConnection.ReadByte(); // Console.Write(s1); //} BluetoothConnection.Close();

The ROBOTC side of the code seems to be in order (especially if the NXT is receiving the data and displaying it properly). For the C# code, I would suggest posting it in a C# specific forum (such as Microsoft's C Sharp answer database: http://social.msdn.microsoft.com/Forums ... sualcsharp) as I am not sure how fluent in C# anyone here may be.

Sorry, I haven't done much robotics lately, and haven't checked the forum.I have to admit, my original code was a bit dodgy.

I have figured how to do it in raw mode now.

Attached is a c# application (the code in a text file).Not only can you send messages from a text box, you can draw in an area, and the program will send the coordinate info to the NXT. It will also send if you're erasing or drawing.

setBluetoothRawDataMode(); // set Bluetooth to "raw mode" while (!bBTRawMode) // while the Bluecore is still NOT in raw mode (bBTRawMode == false): { wait1Msec(1); // wait for Bluecore to enter raw data mode }

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum