Byte 0: How many bytes total in your message. Don’t count bytes 0 and 1.
Byte 1: Always send 0x00 for this byte.
Byte 2: You have two options here. If you send 0x00 then the NXT will send you a return message. If you send 0x80 then no return message is sent. For most of the programs that I wrote I left this byte programmed with 0x00.
Byte 3: This is the command Byte. Sending the byte 0x00 tells the NXT that you are going to call a function.
Byte 4 - 21: In these bytes you send the ASCII equivalents of your file name. For example, byte 4 would be coded with the ASCII equivalent of the first letter in your software file name. In this example we are calling the software file right so ASCII (“l”) is sent.
Byte 5: Here you would send the ASCII value for “e”.
Byte 6: Send ASCII value of “f”
Byte 7: Send ASCII value of “t”
Byte 8: Send ASCII value of “.”
Byte 9: Send ASCII value of “r”
Byte 10: Send ASCII value of “x”
Byte 11: Send ASCII value of “e”
Byte 12: Send null terminator character “0” to end string. This is important!
An example of calling the left program from the NXT is shown below. You can call all of your software files on the NXT by modifying the program code below to match your own software files in visual basic.
'* This functions calles the left software file on the NXT
In the end we implemented a far better method to control the robot using Bluetooth. The technique discussed earlier was still beneficial because it allowed us to run our final program on the NXT. However, for each robot function such as (forward, reverse, left, right, arm up, etc...) we sent values to the NXT mailbox. These values were then manipulated by the program running on the NXT and that function was performed. The commands below are all implemented and fully functional.
Visual Show Automation (VSA), is a software GUI created by Brookshire Software. It allows one to control servos and automation using drag and drop techniques. The software was already purchased by the previous group and we were able to obtain a soft copy of the software from the president of the robotics society. The image below shows an example of the VSA screen. At the bottom of the screen a wav file is shown. This file can be imported by selecting tools -> load audio file from the menu. Before an animation is created, you have to define the servo definitions.
Figure 14: Visual Show Automation The servo definitions are setup in the tools -> settings -> device settings. This is the first step when defining servo name as it allows you to setup minimum and maximum values. Below are the current settings of the servos in the Bohr robot. After the servos are defined, you can drag bars onto the screen. The length of the bars represent the time an animation will run. If you double click a bar you can edit the servo beginning and end positions. For example, to rotate the head from left to right, drag a bar onto the rotate head line. Double click the bar and edit the begin and end positions. The starting position for the robot head is 156 (robot straight), to move the head to the right edit the end value to be 45. Then when the animation plays and the timeline runs over the bar that you just created, the robot head will move from the straight position and end in the right position.