
452
to the specified slave device. Otherwise, the Bluetooth communications device waits for a call
from a master before connecting.
For further details on parameters, refer to the BHT User's Manual.
There are two ways to specify the above parameters.
• Use the system settings
• Specify them in the OPEN statement
The user modifies the system settings with the system menu; the user program, with
extended function BT.FN3 function numbers .fcBTSetVal and .fcBTSetStr. For further
details on the system menu, refer to the BHT User's Manual.
Specifying a parameter in the OPEN statement does not affect the system settings.
Given below are examples connecting to the remote device as master.
(a) Using the system settings
OPEN "COM4:M,SPP" AS #4
(b) Specifying parameters in the OPEN statement
OPEN "COM4:M,SPP,112233AABBCC,BHT,30,2" AS #4
' Address for remote device:
' "11:22:33:AA:BB:CC"
' Bluetooth passkey: BHT
' Connection timeout: 30 seconds
' Security mode: service level
For further details on OPEN "COM4:" statements, refer to Section 18.3 "Bluetooth Statements
and Functions."
(Example)
Connect as master via virtual serial port to the remote device and transfer data in both
directions.
DIM sendbuff$[255] ' Allocate transmit buffer
DIM recvbuff$[255] ' Allocate receive buffer
' Create data to transmit
sendbuff$ = "ABCDEFG" ' Data to transmit = "ABCDEFG"
sendbuff$ = sendbuff$ + BCC$(sendbuff$,2)
' Add block check character
' Open Bluetooth communications device file
' Connect to remote device at address "11:22:33:AA:BB:CC"
Komentarze do niniejszej Instrukcji