Reference Language | Libraries | Comparison | Changes
ArduinoBLE : BLECharacteristic class
unsubscribe
Description
Unsubscribe to a BLE characteristics notifications or indications.
Syntax
bleCharacteristic.unsubscribe()
Parameters
None
Returns
true, on success, false on failure
Example
…
// ...
// retrieve the simple key characteristic
BLECharacteristic simpleKeyCharacteristic = peripheral.characteristic("ffe1");
// subscribe to the simple key characteristic
Serial.println("Subscribing to simple key characteristic ...");
if (!simpleKeyCharacteristic) {
Serial.println("no simple key characteristic found!");
peripheral.disconnect();
return;
} else if (!simpleKeyCharacteristic.canSubscribe()) {
Serial.println("simple key characteristic is not subscribable!");
peripheral.disconnect();
return;
} else if (!simpleKeyCharacteristic.subscribe()) {
Serial.println("subscription failed!");
peripheral.disconnect();
return;
}
// ...
simpleKeyCharacteristic.unsubscribe();
…
See Also
Reference Home
Corrections, suggestions, and new documentation should be posted to the Forum.
The text of the Arduino reference is licensed under a
Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.