• Hi Joost,

    That looks really promising - and it's great that the Wahoo sensor uses a standard Bluetooth LE format for its data as well!

    I think you just want to start notifications on the characteristic - check out http://www.espruino.com/Reference#l_Blue­toothRemoteGATTCharacteristic_startNotif­ications - there's some example code there that should do exactly what you want.

    var gatt;
    NRF.requestDevice({ filters: [{ namePrefix: 'Wahoo' }] }).then(function(device) {
      console.log(device);
      return device.gatt.connect();
    }).then(function(g) {
      gatt = g;
      return gatt.getPrimaryService("1816");
    }).then(function(service) {
      console.log("Service:" + service);
      return service.getCharacteristic("0x2A5B");
    }).then(function(characteristic) {
      characteristic.on('characteristicvaluech­anged', function(event) {
        console.log("-> "+event.target.value);
      });
      return characteristic.startNotifications();
    }).then(function() {
      console.log("Done!");
      // Then call gatt.disconnect(); if/when you want to disconnect
    });
    

    event.target.value should be a DataView so you should be able to pull out the relevant bits of the characteristic pretty easily.

About

Avatar for Gordon @Gordon started