I’m trying to get some telemetry working between a mobile robot and a PC over bluetooth.
[http://bricxcc.sourceforge.net/nbc/ NXC] has all the features you need to send messages between robots and a PC. There are functions to send boolean, integers and so on, using a “mailbox” dispatching of messages, for example ”SendRemoteNumber”.
I’m trying to get some telemetry working between a mobile robot and a PC over bluetooth.
[http://bricxcc.sourceforge.net/nbc/ NXC] has all the features you need to send messages between robots and a PC. There are functions to send boolean, integers and so on, using a “mailbox” dispatching of messages, for example ”SendRemoteNumber”. However I’ve decided to use the simpler ”BluetoothWrite” primitive.
And here’s what I got at the other side, sending strings of ‘*’ of progressive length:
$ cat < /dev/rfcomm0 | od -cx 0000000 001 \0 \0 002 \0 * \0 003 \0 * * \0 004 \0 * * 0001 0200 2a00 0300 2a00 002a 0004 2a2a 0000020 * \0 005 \0 * * * * \0 006 \0 * * * * * 002a 0005 2a2a 2a2a 0600 2a00 2a2a 2a2a In summary, each message sent with ''BluetoothWrite'' results on the PC in the payload length coded on 2 bytes, LSB, then the data sent, including a trailing \0 if you send a string without converting it to a byte array first.