MetaWearC + Chrome OS

Message Body: Hi, I want to make a gyro controler gamepad for chrome package app game.
For connect to the MetaWearC I use Chrome OS Bluetooth API.
I can read info about services and characteristics, but can not read value of characteristics .

my code:

var deviceAddress = "D6:4B:E3:ED:46:3D"

chrome.bluetoothLowEnergy.getServices(deviceAddress, function(services) {
for (var i = 0; i < services.length; i++) {
console.log(services[i]);
chrome.bluetoothLowEnergy.getCharacteristics(services[i].instanceId, function(chracteristics) {
for (var j = 0; j < chracteristics.length; j++) {
console.log(chracteristics[j]);

    // here is a problem

    chrome.bluetoothLowEnergy.readCharacteristicValue(chracteristics[j].instanceId, function(result) {
      if (chrome.runtime.lastError) {
        console.log('Failed to read value: ' + chrome.runtime.lastError.message);
        return;
      }
      var bytes = new Uint8Array(result.value);         
    });
  }
});

}
});

Comments

  • Post the console log messages as well as which characteristics fail to read.

Sign In or Register to comment.