如下是蓝牙写入的官方demo, 怎么把一个16进制0x23写入蓝牙?
// 要写入的数据
var value = new ArrayBuffer(8);
var iv = new Int32Array(value);
iv[0] = 120, iv[2]=100;
// 写入低功耗蓝牙设备的特征值
function writeCharacteristics(){
plus.bluetooth.writeBLECharacteristicValue({
deviceId:deviceId,
serviceId:serviceId,
characteristicId:characteristicId,
value:value,
success:function(e){
console.log('write characteristics success: '+JSON.stringify(e));
},
fail:function(e){
console.log('write characteristics failed: '+JSON.stringify(e));
}
});
}
0 个回复