Skip to content

Instantly share code, notes, and snippets.

@chegewara
Created September 1, 2018 00:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chegewara/3eb386c13cea419a3adc838fdc622600 to your computer and use it in GitHub Desktop.
Save chegewara/3eb386c13cea419a3adc838fdc622600 to your computer and use it in GitHub Desktop.
/**
* A BLE client example that is rich in capabilities.
*/
#include "BLEDevice.h"
//#include "BLEScan.h"
// The remote service we wish to connect to.
static BLEUUID serviceUUID("91bad492-b950-4226-aa2b-4ede9fa42f59");
// The characteristic of the remote service we are interested in.
static BLEUUID charUUID("0d563a58-196a-48ce-ace2-dfec78acc814");
static boolean connected = false;
bool connectToServer(BLEAddress pAddress) {
Serial.print("Forming a connection to ");
Serial.println(pAddress.toString().c_str());
BLEClient* pClient = BLEDevice::createClient();
Serial.println(" - Created client");
// Connect to the remove BLE Server.
pClient->connect(pAddress);
Serial.println(" - Connected to server");
}
void setup() {
Serial.begin(115200);
Serial.println("Starting Arduino BLE Client application...");
BLEDevice::init("");
// BLEScan* pBLEScan = BLEDevice::getScan();
// pBLEScan->setActiveScan(false);
// pBLEScan->start(1);
connectToServer(BLEAddress("30:ae:a4:49:a7:32"));
} // End of setup.
// This is the Arduino main loop function.
void loop() {
delay(1000); // Delay a second between loops.
} // End of loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment