Syntax
boolean connect(
    const char * MACAddr, 
    const char* pinCode = NULL
);
ContentsIndex
PreviousUpNext
LBTClientClass::connect Method (char *, char*)
LBTClientClass Class | Example
Syntax
boolean connect(
    const char * MACAddr, 
    const char* pinCode = NULL
);
Description

Connects a Bluetooth SPP server with a Bluetooth address using a specified Bluetooth address.

Parameters
Parameters 
Description 
const char * MACAddr 
String format (const char *), for example: "12:34:56:ab:cd:ef".
 
const char* pinCode = NULL 
The Bluetooth 2.0 pincode. If you set it as a constant string, it will enable LinkIt One to communicate with a Bluetooth 2.0 device. 
Returns

true: Successful. 

false: Failed.

Example
#include <LBT.h>
#include <LBTClient.h>
  
void setup()
{
  Serial.begin(9600);
  bool success = LBTClient.begin();
  if( !success )
  {
      Serial.println("Cannot begin Bluetooth Client successfully");
      // Do nothing.
      while(true);
  }
  else
  {
      Serial.println("Bluetooth Client begins successfully");
      // start scan, at most scan 15 seconds
      int num = LBTClient.scan(15);
 
      if(num > 0)
      {
          LBTDeviceInfo info = {0};
          bool conn_result = LBTClient.connect("12:34:56:ab:cd:ef");//bool conn_result = LBTClient.connect("12:34:56:ab:cd:ef", "1234");
          if( !conn_result )
          {
              Serial.println("Cannot connect to SPP Server successfully");
              // Do nothing.
              while(true);
          }
          else
          {
             Serial.println("Connect to SPP Server successfully");
          }
      } 
  }
}
File

LBTClient.h

Class