NXT Bluetooth StartProgram Command
Posted: 22 Jun 2011, 08:49
Hi,
I'm currently working on a Mindstorms NXT software project where I use a bluetooth connection and direct commands to control the brick.
I got the motor commands to work properly, but now I have problems with the StartProgramm command as it is written in the Mindstorms documentation.
The format of the command should look like this: Byte 0 - 0x00, Byte 1 - 0x00, Byte 2 to 21 - Filename (ASCIIZ String + Null Termination).
I tried quite everything, but I can't get the brick to start a programm. Maybe someone has an example that uses this command? My programming language is JavaScript, if you are intrested in, and my current approach looks like that:
Than I convert it into a string, that I send to the brick via bluetooth. I'm just wondering if I miss anything important?
Thanks in advance, bye havanab!
I'm currently working on a Mindstorms NXT software project where I use a bluetooth connection and direct commands to control the brick.
I got the motor commands to work properly, but now I have problems with the StartProgramm command as it is written in the Mindstorms documentation.
The format of the command should look like this: Byte 0 - 0x00, Byte 1 - 0x00, Byte 2 to 21 - Filename (ASCIIZ String + Null Termination).
I tried quite everything, but I can't get the brick to start a programm. Maybe someone has an example that uses this command? My programming language is JavaScript, if you are intrested in, and my current approach looks like that:
Code: Select all
bytes[0] = 0x0D; // Length of the command (LSB)
bytes[1] = 0x00; // Length of the Command (MSB)
bytes[z+0] = 0x00; // Direct Command Mode
bytes[z+1] = 0x00; // Start Program command type
bytes[z+2] = 0x31; //Filename in Little Endian Format - "Untitled-1" ---> "1-deltitnU" + Null-Termination
bytes[z+3] = 0x2D;
bytes[z+4] = 0x64;
bytes[z+5] = 0x65;
bytes[z+6] = 0x6C;
bytes[z+7] = 0x74;
bytes[z+8] = 0x69;
bytes[z+9] = 0x74;
bytes[z+10] = 0x6E;
bytes[z+11] = 0x55;
bytes[z+12] = 0x00;
Thanks in advance, bye havanab!