View unanswered posts | View active topics It is currently Mon Sep 21, 2020 4:20 pm

Reply to topic  [ 2 posts ] 
Byte Code Interpreter exeption when using bluetooth. 
Author Message

Joined: Sun Feb 15, 2015 11:19 am
Posts: 1
Post Byte Code Interpreter exeption when using bluetooth.
Hi all.
I am experiencing an error when attempting to use Bluetooth to transfer values between a C# program running on my computer and robot C.
The robot C code is not very fleshed out at the moment as I am simply trying to transfer the values.

First the error:
-This error pops up as soon as I run the program yet isn't detected while the program is being compiled-

ROBOTC Exception Violation Report

Byte Code Interpreter Exception:
Program Slot: 0, Task ID: main[0]
Error at PC: Task: main+0x004E
Task PC: Task offset start (0).
Task State: 'Exception'
Exception Type: 'Invalid opcode(11)'

The robot C code :

task main()
const short bufferSize = 1;
ubyte BytesRead[bufferSize];
nxtReadRawBluetooth(BytesRead[0], bufferSize);


What the C# program is sending via Bluetooth:

byte[] sent = Encoding.ASCII.GetBytes(leftThrottle + ":" + rightThrottle);
mStream.Write(sent, 0, sent.Length);

If leftThrottle is 0 and rightThrottle is 100 then the it would send:
48 58 49 48 48

If anyone can help with my error that would be great but otherwise if you have any other ways for me to turn these values back into 0 , : , 100 then any suggestions would be great as my experience with Robot C is by no means great!!

Sun Feb 15, 2015 11:53 am
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 722
Post Re: Byte Code Interpreter exeption when using bluetooth.
The 'raw' Bluetooth mode was intended to be an implemented feature for the NXT, but it never hit the development schedule; and with the EV3 now being launched, there is less of a chance of it being pushed live. However, you should be able to use the NXT mailbox system, which is documented by LEGO directly.

You can use that messaging format to safely pass messages to and from the LEGO NXT (it's stable and secure enough that the First Tech Challenge competition uses it to send joystick data and competition data to and from the NXT).

Check out our Blog! And our Facebook page!
Need help? Take a look at our updated help documentation and the ROBOTC Forums.

Mon Feb 16, 2015 4:54 pm
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

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

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.