• Which characteristic are you trying to read from? Battery level?

    I think what you need is startNotifications - there's a bit of code in the reference: http://www.espruino.com/Reference#l_Blue­toothRemoteGATTCharacteristic_startNotif­ications

    It looks like there might be a UART characteristic there, and to use that the code above can be used pretty much as-is.

    But for battery I think something like this might do it:

    var gatt;
    NRF.connect("pu:ck:js:ad:dr:es random").then(function(g) {
      gatt = g;
      return gatt.getPrimaryService(0x180F);
    }).then(function(service) {
      return service.getCharacteristic(0x2A19);
    }).then(function(characteristic) {
      characteristic.on('characteristicvaluech­anged', function(event) {
        console.log("battery: "+JSON.stringify(event.target.value.buff­er));
      });
      return characteristic.startNotifications();
    }).then(function() {
      console.log("Done!");
    });
    
About

Avatar for Gordon @Gordon started