Hardware Reference
In-Depth Information
Now that you've got a list of connections, you're going to
try to connect to the one that represents your computer.
You must already be paired with the Bluetooth module
for this to work, so if you aren't, go back to the previous
project and do that now. Then, you need to open the serial
port on your computer that's connected to its Bluetooth
radio.
where address is the Bluetooth address of your
computer that you discovered earlier. When you
get a good connection, the LED on the Mate will
turn on, and you can type back and forth between
the windows. This is more exciting if you have two
computers and connect them via Bluetooth, but it
works on one computer nonetheless.
In Mac OS X, it's the Bluetooth PDA-Sync port. Open a
second window in your terminal program, and connect to
that serial port at 115200 bps.
You're now out of command mode and into data
mode. You should be able to type directly from one
window to the other.
For Windows 7 users, click on the Show Hidden Icons
icon in the taskbar to get to the Bluetooth Devices. Click
the Bluetooth Devices Icon and, from the menu, choose
Open Settings. In the Settings window, choose the Options
paneā€”and make sure that you've allowed other devices
to find this computer, and that you've allowed them to
connect as well. Then click the COM ports pane. If you've
paired with your Bluetooth module before, there will be
two ports indicated for it, one outgoing and one incoming.
You're not using those, though, because Windows tries
to initiate contact when you do. You want the Bluetooth
modem to initiate contact. Add a new incoming port.
Note the port number, then open that port in your serial
terminal program at 115200 bps.
To get out of data mode (to check the modem's
status, for example), type ( \r indicates that you
should hit Enter or Return; don't type the \ or the r ):
$$$\r
This will give you a CMD prompt again. You can now
type any of the commands you want and get replies.
To return to data mode, type:
---\r
Finally, when you're in command mode, you can type
K,\r to disconnect. If you want to connect to another
device, go into command mode and start over again.
For Ubuntu Linux users, the Bluetooth Manager doesn't
support binding a serial port to a discoverable Bluetooth
serial port protocol (SPP) connection, so you'll need to
make the connection outbound from Ubuntu, as described
in the earlier section, "Pairing Your Computer with the
Bluetooth Module." Once you're paired, however, the
procedure to send and receive data, or to switch from
command mode to data mode on the Bluetooth Mate, will
be the same as for other platforms.
Because these commands are just text strings, you
can easily use them in microcontroller programs to
control the module, make and break connections,
and exchange data. Because all the commands are
in ASCII, it's a good idea to exchange data in ASCII
mode, too. So, the data string you set up earlier to
send Monski's sensor readings in ASCII would work
well over this modem.
X
Once you've opened the serial port on your computer,
go back to the window with the serial connection to the
Bluetooth module, and send the following command:
C, address \r
 
Search WWH ::




Custom Search