I recently bought myself a Lego Mindstorm Robotics Kit. The Kit comes with a unit called the NXT Brick. This brick can be programmed using virtually any language using either Bluetooth or USB.
As a project I have decided to try and connect Delphi to the NXT Brick. As I have only started learning delphi, I am somewhat unfamiliar with how Pascal/Delphi send bytes of data. So far I can get Delphi to connect to the NXT brick by simulating a COM port, but I am stuck as how to send data to the brick.
I am using the Synaser (Serial Port Synchronous) Library to get the PC to connect to the NXT Brick via bluetooth.
To send data to the NXT Brick using Perl, I would the following:
my $data = "\x00\x01\x88";
$data = pack("h2", length($data) ) . "\x00" . $data;
$nxt->write( $data );
What the NXT Brick is looking for, if using Bluetooth is:
Byte 0: 0x00 - Length, LSB
Byte 1: 0x00 - Length, MSB
Byte 2: 0x01 - Command Type
Byte 3: 0x88 - Command
Note: All those commands must be prefixed by a 2 bytes header indicating the command length
So, can you please help me work out how to send and receive data to and from the NXT Brick. Any guidance will be most appreciated.