写出特征值。如果特征在远程设备上,将发送写入请求或命令。
用法
bleCharacteristic.writeValue(buffer, length)
bleCharacteristic.writeValue(value)
参数
- buffer: 要写入值的字节数组
- length: 要写入的缓冲区参数的字节数
- value: 要写入的值
返回
- 1关于成功,
- 0失败
示例
// read the button pin
int buttonState = digitalRead(buttonPin);
if (oldButtonState != buttonState) {
// button changed
oldButtonState = buttonState;
if (buttonState) {
Serial.println("button pressed");
// button is pressed, write 0x01 to turn the LED on
ledCharacteristic.writeValue((byte)0x01);
} else {
Serial.println("button released");
// button is released, write 0x00 to turn the LED off
ledCharacteristic.writeValue((byte)0x00);
}
}
相关用法
- Arduino ArduinoBLE - bleCharacteristic.written()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.subscribe()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.hasDescriptor()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.uuid()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.canRead()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.addDescriptor()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.broadcast()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.properties()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.canSubscribe()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.subscribed()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.valueLength()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.unsubscribe()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.canUnsubscribe()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.readValue()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.setEventHandler()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.value()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.valueUpdated()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.canWrite()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.descriptor()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.descriptorCount()用法及代码示例
- Arduino ArduinoBLE - bleCharacteristic.valueSize()用法及代码示例
- Arduino ArduinoBLE - bleDevice.advertisedServiceUuidCount()用法及代码示例
- Arduino ArduinoBLE - bleService.uuid()用法及代码示例
- Arduino ArduinoBLE - bleDescriptor.read()用法及代码示例
- Arduino ArduinoBLE - bleDevice.hasCharacteristic()用法及代码示例
注:本文由纯净天空筛选整理自arduino.cc大神的英文原创作品 ArduinoBLE - bleCharacteristic.writeValue()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。