EmbeddedBlue 500
33
Copyright ©2003 A7 Engineering, Inc.
4.
Click
Cancel
This will close the Bluetooth Configuration dialog.
Step 3: Write a BASIC Stamp Application to Connect to the PC
In this step we will attach an eb500 module to the Board of Education board and
develop a BASIC Stamp application to establish a connection with the PC.
1.
Insert an
eb500
module into the
AppMod connector
of the Board of Education
board; assuring that Pin 1 of the eb500 module is inserted into the VSS pin of the
AppMod header.
2.
Connect the
Board of Education board serial port
to the
PC
.
3.
Open the
BASIC Stamp Editor
.
4.
Enter the following
program code
into the editor, replacing the Bluetooth device
address with the device address of the PC, which we obtained from the Hardware
tab of the Device Properties section of the Bluetooth Configuration dialog in the
previous step.
‘{$STAMP BS2}
‘I/O Line 5 provides the connection status
INPUT 5
‘Wait for the eb500 radio to be ready
PAUSE 1000
‘Connect to the remote device
SEROUT 1,84,[“con 00:80:C8:35:2C:B8”,CR]
SERIN 0,84,[WAIT(“ACK”,CR)]
WaitForConnection:
IF in5 = 0 THEN WaitForConnection
DEBUG “Connected”,CR
‘Wait for 20 seconds
PAUSE 20000
‘I/O Line 6 allows us to switch to Command Mode
OUTPUT 6
‘Switch to Command Mode
LOW 6
SERIN 0,84,[WAIT(CR,”>”)]
‘Disconnect from the remote device
SEROUT 1,84,[“dis”,CR]