蓝牙写数据后模块收不到数据但是返回的是写入成功
发布于 4 年前 作者 ping70 12543 次浏览 来自 问答

 模块写数据代码如下  使用的是苹果手机,返回写入成功但是蓝牙模块没有收到任何数据,蓝牙模块发送过来的数据可以接收到,有没有人知道是什么问题?

var that = this;
        var hex = ‘aaaaaaaaa’
        var typedArray = new Uint8Array(hex.match(/[\da-f]{2}/gi).map(function (h) {
            return parseInt(h, 16)
        }))
        var value = typedArray.buffer
      console.log(“写入数据:”,that.buf2hex(value));
        wx.writeBLECharacteristicValue({
          deviceId: deviceId,
          serviceId: serviceId,
          characteristicId: characteristicId,
          value: value,
          success: function(res){
            // success
            console.log(“写数据成功:”,res)
          },
          fail: function(res) {
             console.log(“写数据失败:”,res)
            // fail
          },
          complete: function(res) {
            // complete
          }
        })
   }

2 回复

占楼,请问楼主解决没有

这个问题我也纠结中,主要是栗子太少了.非官方也就一个,还不确定是否可行,而官方的又过于简单…

回到顶部