Original Author Paul Laughton, 2011
Page 129
De Re BASIC!
1
Listening
Listening for connection
2
Connecting
Connecting to another device
3
Connected
Connected to another device
If the device name string variable <name_svar> is present, it is set to the friendly device name. If your
device has no Bluetooth radio, the string will be empty.
If the address string variable <address_svar> is present, it is set to the MAC address of your Bluetooth
hardware, represented as a string of six hex numbers separated by colons: "00:11:22:AA:BB:CC".
Bt.write {<exp> {,|;}} ...
Writes data to the Bluetooth connection.
If the comma (,) separator is used then a comma will be printed between the values of the expressions.
If the semicolon (;) separator is used then nothing will separate the values of the expressions.
If the semicolon is at the end of the line, the output will be transmitted immediately, with no newline
character(s) added.
The parameters are the same as the Print parameters. This command is essentially a Print to the
Bluetooth connection, with two differences:
Only one byte is transmitted for each character; the upper byte is discarded. Binary data and
ASCII text are sent correctly, but Unicode characters may not be.
A line that ends with a semicolon is sent immediately, with no newline character(s) added.
This command with no parameters sends a newline character to the Bluetooth connection.
Bt.read.ready <nvar>
Reports in the numeric variable the number of messages ready to be read. If the value is greater than
zero then the messages should be read until the queue is empty.
OnBtReadReady:
Interrupt label that traps the arrival of a message received on the Bluetooth channel (see "Interrupt
Labels"). If a Bluetooth message is ready (Bt.read.ready would return a non-zero value) BASIC! executes
the statements after the OnBtReady: label, where you can read and handle the message. When done,
execute the Bt.onReadReady.Resume command to resume the interrupted program.
Bt.onReadReady.resume
Resumes execution at the point in the program where it was interrupted by the Bluetooth Read Ready
event.