#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}; if( LBTClient.getDeviceInfo(0, &info) ) { bool conn_result = LBTClient.connect(info.address);//bool conn_result = LBTClient.connect(info.address, "1234"); if( !conn_result ) { Serial.println("Cannot connect to SPP Server successfully"); // Do nothing. while(true); } else { Serial.println("Connect to SPP Server successfully"); } } else { Serial.println("Device index not correct"); // Do nothing. while(true); } } } }