ArduinoBLE - BLE.available()

Query for a discovered Bluetooth® Low Energy device that was found during scanning.

Syntax

BLE.available()

Parameters

Nothing

Returns

  • BLEDevice representing the discovered device.

Example


  // begin initialization
  if (!BLE.begin()) {
    Serial.println("starting Bluetooth® Low Energy module failed!");

    while (1);
  }

  Serial.println("BLE Central scan");

  // start scanning for peripheral
  BLE.scan();

  

  BLEDevice peripheral = BLE.available();

  if (peripheral) {
     // ...
  }