You are reading a single comment by @billsalt and its replies. Click here to read the full conversation.
  • Hi @Gordon,
    Tried your suggestions above to no avail. I have a nice test bench using two puck-js devices as follows: set up one using the LBS (LightButtonService) I published several months ago. Set up the other to find and set the LED. Here's the code; I've verified that the LBS is still working as advertised (pun intended).

    I get either no service found or an IDE disconnect, sometimes requiring I pull the battery to reset the (finder) device.

    Let me know if you get the same/different results, THANKS!

    LBS code:

    NRF.setAdvertising({}, {name: "Nordic_Blinky"});
    
    pinMode(D5, "output");
    pinMode(D6, "output");
    pinMode(D7, "output");
    pinMode(D31, "output");
    pinMode(D16, "input");
    
    NRF.setServices({
      "00001523-1212-EFDE-1523-785FEABCD123" : {
        "00001524-1212-EFDE-1523-785FEABCD123" : { // button
          value : 0x00, // optional
          broadcast : false, // optional, default is false
          readable : true,   // optional, default is false
          writable : false,   // optional, default is false
          notify : true,   // optional, default is false
          indicate : false,   // optional, default is false
        },
        
        "00001525-1212-EFDE-1523-785FEABCD123" : { // LED
          value : 0x00, // optional
          broadcast : false, // optional, default is false
          readable : true,   // optional, default is false
          writable : true,   // optional, default is false
          notify : false,   // optional, default is false
          indicate : false,   // optional, default is false
                onWrite : function(evt) {
            digitalWrite([D5,D6,D31,D7], evt.data[0]);
                }
        }
        
      }
    });
    
    setWatch(function() {
      NRF.updateServices({
      "00001523-1212-EFDE-1523-785FEABCD123" : {
        "00001524-1212-EFDE-1523-785FEABCD123" : {
          value : 0x01,
          notify: true
        }
      }
    });
    }, D16, {edge:"rising", debounce:50, repeat:true});
    
    
    setWatch(function() {
      NRF.updateServices({
      "00001523-1212-EFDE-1523-785FEABCD123" : {
        "00001524-1212-EFDE-1523-785FEABCD123" : {
          value : 0x00,
          notify: true
        }
      }
    });
    }, D16, {edge:"falling", debounce:50, repeat:true});
    

    Finder code:

    var devices;
    
    NRF.findDevices(function(devices) {
      if (devices.length < 1) throw new Error("Nothing found!");
      devices[0].gatt.connect().then(function(g) {
        gatt = g;
        return gatt.getPrimaryService("00001523-1212-EFDE-1523-785FEABCD123");
      }).then(function(service) {
        return service.getCharacteristic("00001525-1212-EFDE-1523-785FEABCD123");
      }).then(function(characteristic) {
        characteristic.writeValue( [0xff] );
      }).then(function() {
        gatt.disconnect();
        console.log("Done!");
      });
    }, 4000);
    
About

Avatar for billsalt @billsalt started