• Yeah - your other comment about bonding from the neighbor thread did the trick.

    This is working now:

    var gatt;
    function onInit() {
        filters: [{namePrefix: "AB"}]
      }).then((device)=> {
        console.log("FOUND", device.id, device.name);
        return device.gatt.connect();
        gatt = device;
        console.log("CONNECTED", device);
        return gatt.startBonding();
      }).then(function() {
        console.log("BONDED", gatt.getSecurityStatus());
        return gatt.getPrimaryService(0x1812);
        console.log("SERVICE", service);
        return service.getCharacteristic(0x2a4d);
        console.log("CHAR", char);
          console.log("EVENT", e.target.value);
        return char.startNotifications();
        return true;
        console.log("ERROR", err);

    For a button press I get:

    EVENT DataView: {
      "buffer": new Uint8Array([2, 0]).buffer,
      "byteOffset": 0, "byteLength": 2 }

    and for a release:

    EVENT DataView: {
      "buffer": new ArrayBuffer(2),
      "byteOffset": 0, "byteLength": 2 }

    The only thing is that when I pull the power from Espruino the bonding seems to be lost and the blue LED on the remote begins flashing again.

    This does not happen when bonded to Laptop/Phone. Maybe it's about the whitelisting.

    But I could live with that.
    Thanks @Gordon for the hint!


Avatar for ChristianW @ChristianW started