38
User Manual
Copyright ©2003 A7 Engineering, Inc.
PAUSE 1000
‘Connect to the remote device
SEROUT 1,84,[“con 00:04:3E:62:FE:01”,CR]
SERIN 0,84,[WAIT(“ACK”,CR)]
WaitForConnection:
IF in5 = 0 THEN WaitForConnection
DEBUG “Connected”,CR
‘Wait for 20 seconds
PAUSE 20000
‘If there is no connection just exit
IF in5 = 0 THEN Exit
‘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]
SERIN 0,84,[WAIT(CR,”>”)]
Exit:
DEBUG “Disconnected”,CR
The BASIC Stamp application establishes a connection with the remote Bluetooth
device, waits twenty seconds, switches back to command mode and then
disconnects from the remote device.
On the h1940 model of the iPAQ, the Bluetooth software closes the connection after
a short period of time if there is not an application running on the iPAQ to receive the
data over the connection. Therefore, after the twenty second wait, the BASIC Stamp
application checks if there is still a valid connection before switching to Command
Mode. If there is no connection, the eb500 is already in Command Mode.
5.
On the
File
menu, click
Save As
.
6.
In the
File name
box, enter a file name to which to save the program just created.
For example, ConnectPPC.bs2.
7.
Click
Save
.