Reference   Language | Libraries | Comparison | Changes

ArduinoBLE : BLECharacteristic class

BLECharacteristic()

Description

Create a new BLE characteristic.

Syntax

BLECharacteristic(uuid, properties, value, valueSize)
BLECharacteristic(uuid, properties, stringValue)

  • BLEBoolCharacteristic(uuid, properties)
  • BLEBooleanCharacteristic(uuid, properties)
  • BLECharCharacteristic(uuid, properties)
  • BLEUnsignedCharCharacteristic(uuid, properties)
  • BLEByteCharacteristic(uuid, properties)
  • BLEShortCharacteristic(uuid, properties)
  • BLEUnsignedShortCharacteristic(uuid, properties)
  • BLEWordCharacteristic(uuid, properties)
  • BLEIntCharacteristic(uuid, properties)
  • BLEUnsignedIntCharacteristic(uuid, properties)
  • BLELongCharacteristic(uuid, properties)
  • BLEUnsignedLongCharacteristic(uuid, properties)
  • BLEFloatCharacteristic(uuid, properties)
  • BLEDoubleCharacteristic(uuid, properties)

Parameters

uuid: 16-bit or 128-bit UUID in string format
properties: mask of the properties (BLEBroadcast, BLERead, BLEWriteWithoutResponse, BLEWrite, BLENotify, BLEIndicate)
valueSize: (maximum) size of characteristic value
stringValue: value as a string

Returns

New BLECharacteristic with the specified UUID and value

Example


// BLE Battery Level Characteristic
BLEUnsignedCharCharacteristic batteryLevelChar("2A19",  // standard 16-bit characteristic UUID
    BLERead | BLENotify); // remote clients will be able to get notifications if this characteristic changes

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.